This guide explains how to deploy both the backend and frontend to Vercel using the Vercel Dashboard.
You must deploy from the Vercel Dashboard - this ensures:
- Proper monorepo configuration
- Correct workspace linking
- Environment variable management
- Automatic deployments on Git push
This monorepo contains two separate applications that must be deployed as two separate Vercel projects:
| Application | Root Directory | Project Type | Documentation |
|---|---|---|---|
| Backend | backend-fastify |
Serverless API | backend-fastify/DEPLOY.md |
| Frontend | frontend-react |
Static Site (Vite) | frontend-react/DEPLOY.md |
- Go to Vercel Dashboard
- Click "Add New..." → "Project"
- Import your Git repository
- Configure:
- Root Directory:
backend-fastify⚠️ CRITICAL - Framework: Other
- Build Command: (leave empty)
- Output Directory: (leave empty)
- Root Directory:
- Click "Deploy"
- Note your backend URL (e.g.,
https://your-backend.vercel.app)
📖 Full Guide: backend-fastify/DEPLOY.md
- Go to Vercel Dashboard
- Click "Add New..." → "Project" (create a new project)
- Import the same Git repository
- Configure:
- Root Directory:
frontend-react⚠️ CRITICAL - Framework: Vite (auto-detected)
- Build Command:
npm run build(auto-detected) - Output Directory:
dist(auto-detected)
- Root Directory:
- Environment Variables:
- Add
VITE_API_BASE= Your backend URL from step 1 - Apply to: Production, Preview, Development
- Add
- Click "Deploy"
📖 Full Guide: frontend-react/DEPLOY.md
- Root Directory: Must be
backend-fastify - No Build Command: Serverless functions don't need building
- Function Location:
api/server.js(Vercel auto-detects) - Timeout: 30 seconds (configured in
vercel.json)
- Root Directory: Must be
frontend-react - Environment Variable:
VITE_API_BASEmust be set to backend URL - Build Output:
dist/directory - SPA Routing: All routes rewrite to
index.html
Once configured via Dashboard:
- Push to Git: Changes automatically trigger deployments
- Pull Requests: Preview deployments created automatically
- Production: Main branch deploys to production
- No CLI needed: Everything happens automatically
Solution:
- Verify Root Directory is correct (
backend-fastifyorfrontend-react) - Check
package.jsonuses"file:../shared"(not"*") - Check build logs for npm install errors
Solution: ✅ Already fixed - vercel.json uses only functions property
Solution:
- Verify
VITE_API_BASEis set in Vercel Dashboard - Check backend URL is correct
- Ensure backend Deployment Protection is disabled
- Check CORS configuration in backend
Solution:
- Disable Deployment Protection in backend project:
- Settings → Deployment Protection → Disabled
- Verify backend CORS allows all origins (already configured)
- Backend Deployment: backend-fastify/DEPLOY.md
- Frontend Deployment: frontend-react/DEPLOY.md
- Root directory set to
backend-fastify - Deployment successful
- Health endpoint works:
/health - API endpoints respond
- Deployment Protection disabled
- Root directory set to
frontend-react -
VITE_API_BASEenvironment variable set - Deployment successful
- Home page loads
- API calls work
- No console errors