Agency Guide
Deployment & Infrastructure
Deploying and maintaining your agency platform
Recommended Stack
- Hosting: Railway (or any Docker-capable host)
- Database: MongoDB (Railway plugin or Atlas)
- CDN/DNS: Cloudflare
- Storage: Cloudflare R2 or AWS S3
Deploying to Railway
Deploy the app as a Docker service on Railway, with the required environment variables below configured in the service settings.
Environment Variables
Required
| Variable | Description |
|---|---|
SERVER_SECRET | 64-char random string |
MONGODB_URI | MongoDB connection string |
GEMINI_API_KEY | Google AI Studio key |
CORS_ORIGIN | Allowed frontend origins |
REDIRECT_URL | Public API URL |
Auto-injected by Railway
| Variable | Notes |
|---|---|
PORT | Auto-assigned |
MONGODB_URI | Auto-set if using Railway MongoDB plugin |
Custom Domains
- Generate a Railway domain for the service
- Add your custom domain (e.g.,
api.youragency.com) - Create a CNAME record in your DNS pointing to the Railway domain
- If using Cloudflare proxy, SSL is handled automatically
Scaling
- The app is stateless (all state in MongoDB) — scale horizontally
- Increase Railway service resources as needed
- For high call volume, consider separate services for voice and API
Monitoring
- Healthcheck:
GET /status - Railway provides built-in metrics and logging
- Configure
GITHUB_ISSUE_TOKENfor automatic error reporting to GitHub Issues
