Deployment Architecture
Deploying to Convex
Convex hosts your database and backend functions.Prerequisites
Create a project
Go to convex.dev/dashboard and create a new project
Initial Setup
Deploying Updates
Frompackages/database/package.json:
- Validates schema and functions
- Generates types in
_generated/ - Uploads functions to Convex
- Runs migrations if defined
- Activates new version
Environment Variables
Create.env.production in the repository root:
Convex Dashboard
Monitor your deployment:- Go to convex.dev/dashboard
- View Logs for function execution
- Check Tables for data
- Monitor Performance metrics
- Review Errors and stack traces
Deploying to Vercel
Vercel hosts the Next.js application.Prerequisites
Initial Setup
Configuration
Fromapps/main-site/vercel.json:
Environment Variables in Vercel
Set these in Vercel Dashboard → Project → Settings → Environment Variables:Deploying
- Push to GitHub
- Vercel auto-deploys:
mainbranch → Production- Other branches → Preview
Build Configuration
Custom build script inapps/main-site/scripts/build.sh:
Discord Bot Deployment
The Discord bot runs separately from the web application.Hosting Options
- Dedicated Server (e.g., AWS EC2, DigitalOcean)
- Container Platform (e.g., Railway, Fly.io)
- Serverless (not recommended for bots with persistent connections)
Example: Railway Deployment
Bot Environment Variables
Keeping Bot Running
Use a process manager:Continuous Deployment
GitHub Actions
Create.github/workflows/deploy.yml:
Migrations
Convex supports database migrations.Creating a Migration
Running Migrations
Migrations run automatically on deployment, or manually:Monitoring
Convex Logs
View function execution:Vercel Analytics
- Enable in Vercel Dashboard
- View real-time metrics:
- Page views
- Web Vitals
- Top pages
Sentry Error Tracking
Rollback
Convex
Rollback to previous deployment:Vercel
- Go to Vercel Dashboard → Deployments
- Find previous working deployment
- Click Promote to Production
Troubleshooting
Build failures on Vercel
Check build logs in Vercel Dashboard. Common issues:- Missing environment variables
- TypeScript errors
- Convex types out of sync
Convex deployment errors
Discord bot not connecting
Verify:- Bot token is correct
- Bot has required intents enabled
- CONVEX_URL points to production deployment
Next Steps
- Review Database patterns
- Check Testing strategies
- Explore Frontend Development