Deployment Strategy
The Money monorepo consists of multiple Next.js applications that can be deployed independently or together. Each app is optimized for production deployment on various platforms.Applications
Web App
Marketing and landing pages
Secure App
Password manager and vault
CashGap App
Financial tracking platform
Docs App
Documentation site
Deployment Platforms
All apps are Next.js applications and can be deployed to:Vercel (Recommended)
Optimal choice for Next.js apps:- Zero-configuration deployment
- Automatic builds and deployments
- Edge network and CDN
- Preview deployments for PRs
- Built-in environment variable management
Other Platforms
- Netlify: Good Next.js support with plugins
- AWS: EC2, ECS, or Amplify
- Google Cloud: App Engine or Cloud Run
- DigitalOcean: App Platform
- Self-hosted: Docker containers or Node.js servers
Prerequisites
Environment variables configured
All required variables must be set. See Environment Variables.
Database ready
MongoDB instance accessible from production. See Database Setup.
Deploying to Vercel
Initial Setup
Configure environment variables
In the Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add all required variables (see Environment Variables)
- Set variables for Production, Preview, and Development environments
Deploy Individual Apps
Each app needs its own Vercel project:Automatic Deployments
Connect your GitHub repository to Vercel:- Go to Vercel dashboard
- Import your GitHub repository
- Configure root directory for each app:
- Web:
apps/web - Secure:
apps/secure - CashGap:
apps/cashgap - Docs:
apps/docs
- Web:
- Add environment variables
- Deploy
- Deploy
mainbranch to production - Create preview deployments for PRs
- Run builds in the monorepo context
Deploying with Docker
Individual App Dockerfile
Example Dockerfile for the secure app:Build and Run
Deployment Checklist
Pre-deployment
- All tests passing (type check, lint, build)
- Environment variables documented
- Database migrations completed (if any)
- External services configured
- Domain/DNS configured
- SSL certificates ready
Post-deployment
- Application loads correctly
- Authentication works
- Database connections successful
- Email sending works
- OAuth flows complete
- Error monitoring configured
- Logs accessible
- Performance metrics tracked
App-Specific Deployment Notes
Web App
- No database required
- Minimal environment variables
- Can be deployed as static site with ISR
- CDN-friendly
Secure App
- Requires: MongoDB, JWT secrets, Auth secrets
- Optional: Google OAuth, SMTP
- High security requirements
- Session management needed
- Consider database backups
CashGap App
- Requires: MongoDB, Auth secrets
- Optional: Google OAuth, SMTP
- Real-time data updates
- Consider database indexing for performance
Docs App
- No database required
- Minimal environment variables
- Can be deployed as static site
- Consider search indexing
Environment Configuration
Production Variables
Ensure these are set in your deployment platform:Monitoring and Logging
Recommended Tools
- Vercel Analytics: Built-in performance monitoring
- Sentry: Error tracking and monitoring
- LogRocket: Session replay and debugging
- DataDog: Full observability platform
- Vercel Logs: Built-in logging on Vercel
Custom Logging
Next.js outputs logs to stdout/stderr:Performance Optimization
Build Optimization
- Enable SWC compiler (default in Next.js)
- Use Turborepo caching
- Minimize bundle size
Runtime Optimization
- Enable Next.js caching
- Use ISR for static pages
- Implement proper database indexing
- Use CDN for static assets
- Enable compression
Rollback Strategy
If a deployment fails:Vercel
- Go to Deployments in dashboard
- Find previous successful deployment
- Click ”…” → “Promote to Production”
Docker
Troubleshooting
Build Fails in Production
- Check environment variables are set
- Verify Node.js version matches (18+)
- Check build logs for specific errors
- Ensure pnpm version is correct (9.0.0)
App Crashes on Start
- Check database connection
- Verify all required env vars are set
- Check for port conflicts
- Review application logs
Database Connection Errors
- Verify
MONGODB_URIis correct - Check network/firewall rules
- Ensure database accepts connections from deployment IP
- Verify database credentials
Next Steps
Environment Variables
Complete environment variable reference
Database Setup
Configure production database
Building
Build process details
Contributing
Contribution guidelines