Overview
This guide walks you through deploying the Plugin Agency site to Vercel, including build configuration, environment variables, and analytics setup.Prerequisites
- GitHub repository with your code
- Vercel account (sign up free)
- Environment variables ready (see Environment Variables)
Deployment Steps
Connect to Vercel
- Go to vercel.com and sign in
- Click “Add New” → “Project”
- Import your GitHub repository
- Select the repository containing Plugin Agency
Configure Build Settings
Vercel will auto-detect the Vite configuration. Verify these settings:
- Framework Preset: Vite
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
vite.config.js
Add Environment Variables
In Vercel project settings → Environment Variables, add:See the Environment Variables guide for detailed setup.
Optional Variables:
EMAIL_TO- Comma-separated recipient emails (defaults to [email protected])EMAIL_CC- CC recipients
Deploy
Click “Deploy” and wait for the build to complete. Vercel will:
- Install dependencies via
npm install - Run
npm run buildto create production build - Deploy the
distfolder to CDN - Provide a
.vercel.appURL
Vercel Analytics Setup
The site includes Vercel Analytics via the@vercel/analytics package:
src/main.jsx
Enable Analytics
- Go to your Vercel project dashboard
- Navigate to “Analytics” tab
- Click “Enable Analytics”
- Analytics will start tracking automatically (no additional configuration needed)
What Gets Tracked
- Page views
- User sessions
- Performance metrics (Web Vitals)
- Geographic distribution
- Device/browser stats
Custom Domain Setup
Add Domain in Vercel
- Go to Project Settings → Domains
- Add your custom domain (e.g.,
plugin.uy) - Vercel will provide DNS configuration
Build Process Details
Package.json Scripts
package.json
npm run dev- Starts development server on port 5173npm run build- Creates optimized production buildnpm run preview- Preview production build locallynpm run lint- Run ESLint checks
Build Output
The build command generates:Production Optimization
Vite automatically applies these optimizations:- Code Splitting - Lazy loading for better performance
- Minification - Compressed JS/CSS
- Tree Shaking - Remove unused code
- Asset Optimization - Image compression
- CSS Extraction - Separate CSS files for caching
Environment-Specific Builds
Vercel automatically detects the environment:- Production - Main branch deployments
- Preview - Pull request/branch deployments
- Development - Local
npm run dev
Environment variables prefixed with
VITE_ are exposed to the browser. Keep secrets (like RECAPTCHA_SECRET_KEY) without the prefix so they remain server-side only.Troubleshooting
Build Fails
- Check build logs in Vercel dashboard
- Verify all dependencies are in
package.json - Test build locally:
npm run build - Ensure Node version compatibility (18.x or later)
Contact Form Not Working
- Verify environment variables are set
- Check email credentials are correct
- Review function logs in Vercel dashboard
- Test reCAPTCHA keys are valid
Analytics Not Showing
- Ensure
@vercel/analyticsis installed - Verify Analytics is enabled in Vercel dashboard
- Allow 24 hours for initial data collection
- Check browser ad-blockers aren’t blocking tracking
Redeployment
To redeploy:- Push to GitHub - Automatic deployment on push to main branch
- Manual Deploy - Use Vercel dashboard “Redeploy” button
- Rollback - Revert to previous deployment in Vercel
Next Steps
Environment Variables
Configure all required variables
Configuration
Customize Vite and ESLint settings