Deploy to Railway
Deploy WhatsApp Team Inbox to Railway in minutes with built-in PostgreSQL and automatic HTTPS.TL;DR - Quick Deploy
Fork & Connect
Add Services
/backend) and frontend (/web)Set Variables
Deploy
Why Railway?
One-Click Deploy
Included Database
Auto HTTPS
Affordable
Prerequisites
Quick Deploy
Option 1: Deploy Button (Fastest)
Click the button below to deploy instantly:- Create a new project
- Set up PostgreSQL database
- Deploy backend and frontend
- Generate automatic HTTPS URLs
Option 2: Manual Deployment
Fork the Repository
- Go to the WhatsApp Team Inbox repository
- Click Fork in the top right
- Create a fork in your account
Create Railway Project
- Log in to Railway
- Click New Project
- Select Deploy from GitHub repo
- Authorize Railway to access your GitHub
- Select your forked repository
Add PostgreSQL Database
- Click + New in your project
- Select Database → PostgreSQL
- Railway will provision a database automatically
Configure Backend Service
- Click + New → GitHub Repo
- Select your repository
- Set Root Directory:
backend - Railway will detect
Dockerfileautomatically
Configure Frontend Service
- Click + New → GitHub Repo
- Select your repository again
- Set Root Directory:
web - Railway will detect Next.js automatically
Environment Variables
After deployment, configure environment variables for each service.Backend Environment Variables
In Railway dashboard, go to Backend service → Variables tab:Database (Auto-configured)
Database (Auto-configured)
WhatsApp API (Required)
WhatsApp API (Required)
Security (Required)
Security (Required)
Admin User (Required)
Admin User (Required)
Application URLs (Auto-configured)
Application URLs (Auto-configured)
Optional: Email (SMTP)
Optional: Email (SMTP)
Optional: Push Notifications
Optional: Push Notifications
Frontend Environment Variables
In Railway dashboard, go to Frontend service → Variables tab:${{ServiceName.VARIABLE}} with actual valuesCustom Domain (Optional)
Add Custom Domain
Access Settings
Add Domain
Configure DNS
Update Environment Variables
Database Management
Access Database
Get Database URL
DATABASE_URLConnect via CLI
Run Migrations
Database Backups
Railway automatically creates daily backups. To restore:- Go to PostgreSQL service → Backups tab
- Select a backup
- Click Restore
Webhook Configuration
After deployment, configure WhatsApp webhook:Get Backend URL
Configure in Meta Business Suite
WHATSAPP_WEBHOOK_VERIFY_TOKEN from your environment variablesTest Webhook
Monitoring & Logs
View Logs
Access Service Logs
Real-time Logs
- Error level
- Timestamp
- Search terms
Download Logs
Metrics & Usage
Railway provides built-in metrics:- CPU Usage - Monitor backend processing
- Memory - Track memory consumption
- Network - Monitor incoming/outgoing traffic
- Database Size - Track PostgreSQL storage
Scaling
Vertical Scaling
Railway automatically scales resources based on usage:Starter Plan
- $5/month
- 512MB RAM
- Shared CPU
- 1GB database
Pro Plan
- $20/month
- 8GB RAM
- Dedicated CPU
- 10GB database
Horizontal Scaling
For high traffic:- Go to service → Settings
- Enable High Availability
- Set number of replicas
- Railway will load balance automatically
Deployment Triggers
Auto-Deploy on Push
Railway automatically deploys when you push to your GitHub repository:Manual Deployment
Trigger manual deployment:- Go to service → Deployments
- Click Deploy
- Select branch to deploy
Deploy Specific Branch
- Service → Settings
- Under Source, change Deploy Branch
- Select branch (main, develop, staging, etc.)
Cost Optimization
Minimize Costs
Use Resource Limits
Use Resource Limits
- CPU limit: 1 vCPU
- Memory limit: 512MB
Enable Sleep Mode
Enable Sleep Mode
Optimize Database
Optimize Database
- Regular vacuum operations
- Remove unused indexes
- Archive old conversations
- Monitor storage growth
Use Hobby Plan for Testing
Use Hobby Plan for Testing
Troubleshooting
Build Failed
Build Failed
- Missing dependencies in package.json
- Build errors in code
- Node version mismatch
- Check build logs in Deployments tab
- Verify package.json scripts
- Set Node version in Settings → Environment
Database Connection Failed
Database Connection Failed
- DATABASE_URL not set correctly
- Database service not running
- Verify DATABASE_URL in Variables tab
- Check PostgreSQL service status
- Restart backend service
Frontend Can't Connect to Backend
Frontend Can't Connect to Backend
- NEXT_PUBLIC_API_BASE_URL incorrect
- CORS not configured
- Verify NEXT_PUBLIC_API_BASE_URL uses HTTPS
- Check CORS_ORIGIN in backend includes frontend URL
- Review backend logs for CORS errors
Webhook Not Receiving Messages
Webhook Not Receiving Messages
- Webhook URL not accessible
- Verify token mismatch
- Test webhook URL:
curl https://your-backend/api/webhook - Verify WHATSAPP_WEBHOOK_VERIFY_TOKEN matches Meta
- Check backend logs for incoming webhook requests
Production Checklist
Before going live:Railway CLI (Advanced)
For advanced users, use Railway CLI:Install CLI
Deploy from CLI
Migration from Other Platforms
From Heroku
Export Heroku Config
Import to Railway
Migrate Database
From DigitalOcean
Export Database
Import to Railway
Update Environment Variables