Deploy to Vercel
Vercel is the recommended deployment platform for SmarterAvatar.
Prerequisites
- GitHub/GitLab/Bitbucket repository with SmarterAvatar code
- Vercel account (vercel.com)
- PostgreSQL database (Supabase recommended)
- All API keys configured
Step-by-Step Guide
1. Prepare Repository
Ensure your repository has:
├── .env.example # Environment template
├── package.json # With build script
├── next.config.js # Next.js configuration
└── prisma/schema.prisma # Database schema
2. Connect to Vercel
- Go to vercel.com/new
- Import your repository
- Select the repository
- Configure project settings
3. Configure Build Settings
Vercel typically auto-detects Next.js. Verify:
| Setting | Value |
|---|---|
| Framework Preset | Next.js |
| Build Command | pnpm build |
| Output Directory | .next |
| Install Command | pnpm install |
4. Add Environment Variables
In Vercel project settings, add all required environment variables:
# Database
DATABASE_URL=postgresql://...
# LLM
LLM_PROVIDER=gemini
GEMINI_API_KEY=AIza...
# STT
STT_PROVIDER=whisper
OPENAI_API_KEY=sk-...
# Avatar
LIVEAVATAR_API_KEY=...
NEXT_PUBLIC_AVATAR_ID=...
NEXT_PUBLIC_VOICE_ID=...
# Public URL (set after first deploy)
NEXT_PUBLIC_BASE_API_URL=https://your-project.vercel.app
5. Deploy
Click Deploy and wait for the build to complete.
6. Run Database Migrations
After deploy, run migrations:
# Using Vercel CLI
vercel env pull .env.local
npx prisma migrate deploy
Or use the Vercel Postgres integration for automatic migrations.
7. Verify Deployment
Visit your deployed URL and check:
- ✅ Home page loads
- ✅ Avatar session starts
- ✅ Chat responses work
- ✅ Admin panel accessible
Custom Domain
- Go to Project Settings → Domains
- Add your custom domain
- Configure DNS as instructed
- Update
NEXT_PUBLIC_BASE_API_URLenvironment variable
Production Checklist
Before going live:
- All environment variables set
- Database migrations run
- API keys are production keys (not test)
- Custom domain configured
- SSL certificate active
- Error tracking configured (optional)
- Analytics enabled (optional)
Troubleshooting
Build Fails
Check the build logs for specific errors. Common issues:
- Missing environment variables
- TypeScript errors
- Dependency conflicts
Database Connection Fails
- Verify
DATABASE_URLis correct - Check database is accessible from Vercel's IP ranges
- Ensure SSL is enabled if required
Avatar Not Loading
- Verify HeyGen API key is valid
- Check
NEXT_PUBLIC_variables are set - Review browser console for errors