Convex
Deploy and Host Convex with Railway
Convex Backend
get-convex/convex-backend:latest
Just deployed
/convex/data
Convex Dashboard
get-convex/convex-dashboard:latest
Just deployed
Postgres
postgres:17
Just deployed
/var/lib/postgresql/data
Deploy and Host Convex with Railway
Convex is an open-source reactive database designed for web app developers and LLMs. Fetch data and implement business logic with strong consistency using pure TypeScript.
About Hosting Convex
Self-hosting Convex gives you full control over deployment, scaling, and security. This guide covers running a self-hosted Convex instance on Railway, including configuration for public/private access and admin key management. Railway automates provisioning, networking, and updates—so you can focus on application logic instead of infrastructure.
Environment Variables
Variable | Description | Secret | Example/Notes |
---|---|---|---|
CONVEX_SELF_HOSTED_ADMIN_KEY | Admin key for Convex instance | Yes | Auto-generated in deploy logs on first run. Paste value here. |
INSTANCE_SECRET | Instance secret for encryption and identity | Yes | generate with template variable functions. To reset, see steps below. |
CONVEX_CLOUD_ORIGIN | Controls allowed cloud request origins | No | Set according to public/private deployment settings. |
CONVEX_SITE_ORIGIN | Controls web frontend origins | No | Set according to public/private deployment settings. |
Deploy and Host
Configure CONVEX_SELF_HOSTED_ADMIN_KEY
- On the first run of Convex Backend, an auto-generated Admin Key: XXX|XXXX will appear in the Deploy Logs. Copy this key and set it as the value for CONVEX_SELF_HOSTED_ADMIN_KEY, then restart Convex Backend.
- If you need to modify INSTANCE_SECRET, first set CONVEX_SELF_HOSTED_ADMIN_KEY to invalid, then redo Step 1 after the change to generate a new admin key.
Public/Private Configuration
For Public Deployment:
- Set CONVEX_CLOUD_ORIGIN to ${{PUBLIC_CONVEX_CLOUD_ORIGIN}}
- Set CONVEX_SITE_ORIGIN to ${{PUBLIC_CONVEX_SITE_ORIGIN}}
- Expose HTTP networking for Convex Backend on port 3210 and TCP on port 3211
- Expose HTTP networking for Convex Dashboard on port 8080
For Private Deployment:
- Set CONVEX_CLOUD_ORIGIN to ${{PRIVATE_CONVEX_CLOUD_ORIGIN}}
- Set CONVEX_SITE_ORIGIN to ${{PRIVATE_CONVEX_SITE_ORIGIN}}
- Convex Dashboard is not available in Private mode.
Common Use Cases
- Real-time applications: chat apps, live dashboards, collaborative tools
- Serverless backends: APIs with automatic scaling and zero cold starts
- Full-stack projects: Unified backend for Next.js, React, or other frontend frameworks
Dependencies for Convex Hosting
The Railway template includes the required Convex backend, Convex dashboard, and PostgreSQL database.
Deployment Dependencies
Why Deploy Convex on Railway?
Railway is a unified platform for deploying your infrastructure stack. It hosts your infrastructure without complex configuration, allowing you to scale vertically and horizontally.
By deploying Convex on Railway, you'll be closer to supporting a full-stack application with minimal operational burden. Host servers, databases, AI agents, and more—all on Railway.
Template Content
Convex Backend
ghcr.io/get-convex/convex-backend:latestConvex Dashboard
ghcr.io/get-convex/convex-dashboard:latestPostgres
postgres:17