Pre-Deployment Checklist
Environment Configuration
Ensure all production environment variables are set correctly.
NODE_ENV=productionAPP_KEYis set (usenode ace generate:key)- Database credentials configured
- Email service configured (Resend or SMTP)
- OAuth credentials for Google login
Docker Production Deployment
Building the Production Image
The production Dockerfile is optimized for size and security:- Alpine Linux base (minimal size)
- Multi-stage build considerations
- Frozen lockfile for reproducibility
- Production build optimization
Deploy with Docker Compose
Production Stack Architecture
The production setup includes:Traditional Server Deployment
Server Requirements
Minimum Specs
- 1 CPU core
- 1GB RAM
- 10GB storage
- Ubuntu 22.04 or later
Recommended Specs
- 2+ CPU cores
- 2GB+ RAM
- 20GB+ storage
- Load balancer ready
Manual Deployment Steps
SSL/TLS Setup with Let’s Encrypt
Platform-as-a-Service Deployments
Deploying to Railway
Connect Repository
- Create a new project on Railway
- Connect your GitHub repository
- Select the
apps/webdirectory as root
Configure Services
Add services:
- PostgreSQL database (from Railway marketplace)
- Redis (optional, for caching)
Deploying to Render
Create Web Service
- Go to Render Dashboard
- New → Web Service
- Connect repository
Add PostgreSQL
- Create PostgreSQL database from Render dashboard
- Copy connection details
- Add to environment variables
Deploying to Fly.io
Database Management
Migrations
Backup Strategy
- Manual Backup
- Docker Backup
- Automated Backup
Monitoring and Logging
Application Logs
Health Checks
Implement health check endpoint:Performance Monitoring
Consider integrating:Infrastructure Monitoring
Scaling Considerations
Horizontal Scaling
Stateless Application
Ensure your application is stateless:
- Use database for sessions (not memory)
- Store uploads in S3/cloud storage
- Use Redis for cache and queues
Vertical Scaling
Adjust resource limits:Troubleshooting
Application won't start
Application won't start
- Check environment variables:
- Verify build completed:
- Check for missing dependencies:
Database connection errors
Database connection errors
- Verify database is running:
- Test connection:
- Check credentials in
.env
High memory usage
High memory usage
- Check Node.js memory limit:
- Review database query performance
- Implement caching strategy
Slow response times
Slow response times
- Enable query logging:
- Add database indexes
- Implement Redis caching
- Use CDN for static assets
Security Checklist
-
APP_KEYis unique and secret - Database uses strong password
- HTTPS/SSL enabled
- CORS configured for production domains
- Rate limiting enabled
- CSRF protection active
- Security headers configured
- Secrets stored in environment variables (not code)
- Regular security updates applied
- Database backups automated
- Monitoring and alerts configured
Next Steps
Docker Setup
Learn about Docker configuration
Environment Variables
Configure environment variables