Prerequisites
Before deploying, ensure you have accounts for:- Vercel - Hosting platform
- Convex - Real-time database backend
- Inngest Cloud - Background job processing
- Clerk - Authentication (or Stack Auth)
- E2B - Code sandbox environment
- Polar.sh - Billing and subscriptions
- OpenRouter - AI model gateway
- Cerebras - Ultra-fast AI inference (optional)
Step 1: Set Up Inngest Cloud
Inngest Cloud handles background AI code generation workflows.Create an Inngest Account
Go to Inngest Cloud and sign up or log in
Step 2: Deploy Convex Backend
Convex provides the real-time database for ZapDev.Create Production Deployment
- Create a production deployment
- Provide your
NEXT_PUBLIC_CONVEX_URL - Deploy your database schema and functions
Step 3: Build E2B Sandbox Template
Step 4: Deploy to Vercel
Import to Vercel
- Go to Vercel Dashboard
- Click “New Project”
- Import your GitHub repository
- Select the repository containing ZapDev
Configure Build Settings
Vercel should auto-detect Next.js. Verify:
- Framework Preset: Next.js
- Build Command:
bun run build - Install Command:
bun install - Output Directory:
.next(default)
Add Environment Variables
In the Vercel project settings, add all environment variables (see below).
Step 5: Configure Environment Variables
Add these environment variables in your Vercel project settings:Application
Convex Database
Clerk Authentication
Create a JWT template named “convex” in Clerk Dashboard → JWT Templates for Convex integration.
Polar.sh Billing
AI Services
E2B Sandboxes
Inngest (Background Jobs)
Optional Services
Step 6: Sync with Inngest Cloud
After Vercel deployment completes, connect Inngest to your app:Sync with Inngest
- Go to Inngest Dashboard
- Navigate to your app
- Click “Sync App”
- Add URL:
https://your-app.vercel.app/api/inngest - Click “Sync”
Step 7: Configure Webhooks
Clerk Webhooks
Update Webhook URL
- Go to Clerk Dashboard → Webhooks
- Update webhook URL to:
https://your-app.vercel.app/api/webhooks/clerk
Polar.sh Webhooks
Step 8: Set Up Cron Jobs
ZapDev includes a cron job for sandbox cleanup defined invercel.json:
Monitoring Your Deployment
Vercel Dashboard
- Deployments: Track build status and history
- Logs: Real-time function logs and errors
- Analytics: Performance metrics and Web Vitals
- Speed Insights: Core Web Vitals monitoring
Convex Dashboard
Monitor at dashboard.convex.dev:- Data: View database tables and documents
- Functions: Query and mutation execution logs
- Logs: Real-time backend logs
- Deployments: Schema change history
Inngest Dashboard
Monitor at app.inngest.com:- Functions: View all registered functions
- Runs: Execution history and status
- Errors: Failed runs with replay capability
- Crons: Scheduled job execution times
E2B Dashboard
Monitor at e2b.dev/account:- Sandboxes: Active and paused sandboxes
- Usage: API calls and compute time
- Costs: Real-time cost tracking
Auto-pause should reduce E2B costs by 30-50% by pausing inactive sandboxes every 5 minutes.
Troubleshooting
Deployment Fails
Issue: Build fails with TypeScript errors Solution:Inngest Not Syncing
Issue: Inngest shows “Failed to sync” error Solution:- Verify
INNGEST_EVENT_KEYandINNGEST_SIGNING_KEYare correct - Check Vercel function logs for
/api/inngesterrors - Ensure endpoint is publicly accessible
- Re-deploy and try syncing again
AI Generation Not Working
Issue: Code generation fails or hangs Solutions:-
Verify E2B Template:
-
Check API Keys:
- Verify
E2B_API_KEYis valid - Test
CEREBRAS_API_KEYorOPENROUTER_API_KEY
- Verify
-
Review Inngest Logs:
- Check for sandbox creation errors
- Look for API timeout issues
Database Connection Issues
Issue: Convex queries failing Solution:- Verify
NEXT_PUBLIC_CONVEX_URLis correct - Check Convex dashboard for deployment status
- Ensure JWT template is configured in Clerk
- Re-deploy Convex:
bunx convex deploy
Webhook Failures
Issue: Clerk or Polar webhooks not received Solution:- Check webhook URLs are correct
- Verify webhook secrets match environment variables
- Review Vercel function logs for webhook endpoints
- Test webhook delivery in service dashboard
Production Checklist
Before launching to production:- All environment variables configured in Vercel
- Convex backend deployed (
bunx convex deploy) - E2B template built with production name
- Inngest Cloud synced successfully
- Clerk webhooks configured with production URL
- Polar.sh webhooks configured
- Test user registration flow
- Test AI code generation end-to-end
- Verify cron job execution in logs
- Monitor first few Inngest function runs
- Check E2B sandbox creation and auto-pause
- Configure custom domain (optional)
- Enable Vercel Speed Insights
- Set up Sentry error tracking (optional)
Updating Your Deployment
Code Changes
Schema Changes
Environment Variables
- Update in Vercel Dashboard → Settings → Environment Variables
- Redeploy: Vercel Dashboard → Deployments → Redeploy
Next Steps
Docker Deployment
Alternative deployment using Docker containers
Self-Hosted
Deploy on your own infrastructure