Prerequisites
Before deploying, ensure you have:- A Vercel account
- All required API keys and credentials (see Environment Variables)
- Access to your Git repository (GitHub, GitLab, or Bitbucket)
- Supabase project configured
- Vapi AI account with web token
- ElevenLabs API key
- OpenAI API key
- Upstash Redis instance
Build Configuration
The application uses Next.js 15 with the following build configuration:Build Command
next build which:
- Compiles TypeScript to JavaScript
- Bundles and optimizes all pages and components
- Generates static assets
- Creates optimized production builds
- Validates environment variables required at build time
Build Requirements
These are validated innext.config.ts:3 and various lib files during the build process.
Deploying to Vercel
Method 1: Git Integration (Recommended)
Connect Repository
- Log in to Vercel Dashboard
- Click “Add New Project”
- Import your Git repository
- Select the repository containing Echoes of the Past
Configure Build Settings
Vercel auto-detects Next.js projects. Verify these settings:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next(default) - Install Command:
npm install - Node Version: 20.x or higher
Set Environment Variables
Add all required environment variables in the Vercel project settings:
- Navigate to “Settings” → “Environment Variables”
- Add each variable from the Environment Variables reference
- Set appropriate values for Production, Preview, and Development environments
Use different values for production and preview environments, especially for sensitive credentials and API endpoints.
Method 2: Vercel CLI
For manual deployments or CI/CD pipelines:Environment Variables in Production
Setting Variables
Environment variables can be set in multiple ways: Via Vercel Dashboard:Environment Scopes
Set different values for each environment:- Production: Used for
vercel --proddeployments - Preview: Used for branch and PR deployments
- Development: Used locally with
vercel dev
Domain Configuration
Adding a Custom Domain
Add Domain in Vercel
- Go to Project Settings → Domains
- Enter your custom domain (e.g.,
echoes.yourdomain.com) - Click “Add”
Image Optimization
The application is configured to serve images from multiple sources (seenext.config.ts:8-64):
- Supabase Storage
- CDN providers (Midjourney, Unsplash, etc.)
- Wikipedia media
Image optimization is included in Vercel’s Pro plan and above. On the Hobby plan, you get 1,000 source images optimized per month.
Monitoring Setup
Vercel Analytics
The application includes Vercel Analytics (seeapp/layout.tsx:40):
- Real-time visitor analytics
- Page view tracking
- Performance metrics
- Web Vitals monitoring
Umami Analytics
Production deployments also include Umami analytics (seeapp/layout.tsx:43):
Custom Monitoring
For additional monitoring, consider:- Error Tracking: Sentry, LogRocket, or Datadog
- Performance: Vercel Speed Insights
- Uptime: UptimeRobot, Pingdom
- Logs: Vercel Logs or external log aggregation
Production Checklist
Before going live, verify:Environment Variables
- All required variables set in Vercel
- Production API keys (not test/development keys)
-
NEXT_PUBLIC_APP_URLmatches production domain - Redis credentials point to production instance
- Supabase points to production project
Authentication
- Google OAuth configured with production callback URL
- Supabase auth providers enabled
- Redirect URLs whitelist updated
APIs & Services
- Vapi AI production token configured
- ElevenLabs API key with sufficient quota
- OpenAI API key with appropriate rate limits
- Upstash Redis production instance
Performance
- Build completes without warnings
- No console errors in production
- Images load and optimize correctly
- Voice calls connect successfully
Continuous Deployment
Vercel automatically deploys:- Production: Commits to
mainbranch - Preview: Pull requests and other branches
Deployment Protection
Configure deployment protection for production:- Go to Project Settings → Git
- Enable “Production Branch” protection
- Require approval for production deployments (optional)
Build Performance
Optimize build times:node_modules(if package.json unchanged)- Next.js build cache
- npm/yarn global cache
Troubleshooting
Build Failures
Error: Environment variable not setnpm run build locally to identify and fix type errors.
Runtime Issues
OAuth callback fails Verify:NEXT_PUBLIC_APP_URLmatches your domain- Callback URL registered in Google Console:
https://yourdomain.com/auth/callback - Supabase redirect URLs include production domain
NEXT_PUBLIC_VAPI_WEB_TOKENis set correctlyNEXT_PUBLIC_SERVER_URLpoints to production webhook endpoint- ElevenLabs API key is valid and has quota
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENare correct- Redis instance is accessible from Vercel’s network
- Instance has not hit connection limits
Rollback Strategy
If issues occur in production:Instant Rollback
- Go to Deployments tab in Vercel
- Find the last working deployment
- Click “Promote to Production”
Via CLI
Next Steps
- Review Environment Variables reference
- Set up monitoring and alerts
- Configure backup strategies
- Implement CI/CD testing pipelines
- Review Vercel usage and quotas