This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Learn more about the recommended Project Setup and IDE Support in the Vue Docs TypeScript Guide.
This project includes a contact form that sends submissions via email using Netlify serverless functions.
- SendGrid Account: Sign up at SendGrid and get an API key
- Netlify Account: Deploy your site to Netlify
Create a .env file in the project root (or set these in Netlify's dashboard):
SENDGRID_API_KEY=your_sendgrid_api_key_here
RECIPIENT_EMAIL=han@sent.com
SENDER_EMAIL=your_verified_sender_email@example.comImportant:
SENDGRID_API_KEY: Get this from your SendGrid dashboard (Settings > API Keys)RECIPIENT_EMAIL: The email address that will receive form submissions (defaults tohan@sent.com)SENDER_EMAIL: Must be a verified sender email in SendGrid (for production)
-
Install dependencies:
npm install
-
Set up your
.envfile with the variables above -
Install Netlify CLI (if not already installed):
npm install -g netlify-cli
-
Run the development server with Netlify Functions:
netlify dev
This will start both the Vite dev server and Netlify Functions locally.
-
Build the project:
npm run build
-
Deploy to Netlify:
- Connect your repository to Netlify
- Set the environment variables in Netlify Dashboard (Site Settings > Build & Deploy > Environment Variables)
- Netlify will automatically detect the
netlify.tomlconfiguration
To add form submissions to a Google Sheet:
- Create a Google Cloud project and enable Google Sheets API
- Create a service account and download credentials
- Share your Google Sheet with the service account email
- Update the
sendEmail.tsfunction to also append data to the sheet
├── netlify/
│ └── functions/
│ └── sendEmail.ts # Serverless function for sending emails
├── src/
│ └── components/
│ └── ContactForm.vue # Contact form component
└── netlify.toml # Netlify configuration