Deployment Architecture
WhatsApp Team Inbox consists of three main components that need to be deployed:Components
Frontend
Next.js 14 application served via Vercel, Netlify, or self-hosted
Backend
Express.js API server on Railway, Heroku, or VPS
Database
PostgreSQL database on Railway, AWS RDS, or managed service
Deployment Options
Option 1: Fully Managed (Recommended)
1
Frontend on Vercel
- Zero configuration deployment
- Automatic HTTPS
- Global CDN
- Cost: Free tier available
2
Backend on Railway
- Easy deployment from GitHub
- Automatic scaling
- Built-in PostgreSQL
- Cost: ~$5-25/month
3
Database on Railway
- Managed PostgreSQL
- Automatic backups
- Connection pooling
- Included with backend
Option 2: Cloud Provider (AWS/GCP/Azure)
1
Frontend
- AWS Amplify / Google Cloud Run / Azure Static Web Apps
- Full control over configuration
- Cost: Pay-as-you-go
2
Backend
- AWS ECS / Google Cloud Run / Azure Container Apps
- Container-based deployment
- Cost: ~$20-100/month
3
Database
- AWS RDS / Cloud SQL / Azure Database
- Fully managed
- Cost: ~$15-50/month
Option 3: Self-Hosted (VPS)
1
VPS Provider
DigitalOcean, Linode, or Vultr
- Full control
- Cost: ~$10-40/month
2
Setup
- Install Node.js, PostgreSQL, Nginx
- Configure reverse proxy
- Setup SSL with Let’s Encrypt
Pre-Deployment Checklist
Database created and accessible
Environment variables configured
WhatsApp Business API account created
Email service (Resend) account created
Domain name registered
SSL certificate obtained
DNS configured
Webhook URLs ready
External Services Required
WhatsApp Business API
- Free test mode (5 conversations/day)
- Production: Pay per conversation
- Setup time: ~1 hour
Email Service (Resend)
- 3,000 emails/month free
- Domain verification required
- Setup time: ~30 minutes
Database (PostgreSQL)
- Railway: $5/month
- AWS RDS: ~$15/month
- Setup time: ~15 minutes
Push Notifications
- Free (using Web Push API)
- VAPID keys required
- Setup time: ~5 minutes
Environment Variables
You’ll need to configure these for production:Backend Environment Variables
Backend Environment Variables
Frontend Environment Variables
Frontend Environment Variables
Security Considerations
HTTPS Only
All traffic must use HTTPS in production
Secure Cookies
Set
COOKIE_SECURE=true in productionCORS Configuration
Whitelist only your frontend domain
Rate Limiting
Configure appropriate limits for your use case
Deployment Steps
1
Setup External Services
- Configure WhatsApp Business API
- Setup Resend for emails
- Create PostgreSQL database
2
Configure Environment Variables
- Add all required env vars to hosting provider
- Generate secrets (JWT, VAPID keys)
- Test database connection
3
Deploy Backend
- Push to GitHub/GitLab
- Connect to Railway/Heroku
- Run database migrations
- Verify API health endpoint
4
Deploy Frontend
- Configure env vars in Vercel
- Connect GitHub repository
- Deploy and verify build
5
Configure Webhooks
- Set WhatsApp webhook URL
- Verify webhook connection
- Test message reception
6
Testing
- Send test WhatsApp message
- Test push notifications
- Verify email sending
- Check all features work
Post-Deployment
Monitoring
Setup monitoring and alerting
Backups
Configure automated database backups
SSL Renewal
Ensure auto-renewal is configured
Scaling
Plan for horizontal scaling if needed
Cost Estimates
Monthly costs for a small team (100 conversations/day):
| Service | Provider | Cost |
|---|---|---|
| Frontend | Vercel | $0 (free tier) |
| Backend | Railway | $5-20 |
| Database | Railway | Included |
| WhatsApp API | Meta | $50-200 |
| Resend | $0 (free tier) | |
| Domain | Namecheap | $10/year |
| SSL | Let’s Encrypt | Free |
| Total | ~$60-230/month |