Convex

Deploy and Host Convex with Railway

Deploy Convex

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

VariableDescriptionSecretExample/Notes
CONVEX_SELF_HOSTED_ADMIN_KEYAdmin key for Convex instanceYesAuto-generated in deploy logs on first run. Paste value here.
INSTANCE_SECRETInstance secret for encryption and identityYesgenerate with template variable functions. To reset, see steps below.
CONVEX_CLOUD_ORIGINControls allowed cloud request originsNoSet according to public/private deployment settings.
CONVEX_SITE_ORIGINControls web frontend originsNoSet according to public/private deployment settings.

Deploy and Host

Configure CONVEX_SELF_HOSTED_ADMIN_KEY

  1. 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.
  2. 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

More templates in this category

View Template
ReadySet
A lightweight caching engine for Postgres

View Template
Simple S3
Deploy a S3-compatible storage service with a pre-named bucket.

View Template
Flare
A modern, lightning-fast file sharing platform built for self-hosting