Deploy Convex & Postgres - Official

Convex is the open-source reactive database for app developers + Postgres.

Deploy Convex & Postgres - Official

Postgres

postgres:17

Just deployed

/var/lib/postgresql/data

Just deployed

/convex/data

Just deployed

Deploy and Host Convex & Postgres - Official on Railway

Host a Convex reactive backend, its administration dashboard, and a PostgreSQL database in your Railway project.

About Hosting Convex & Postgres - Official

The template includes three services: Postgres, convex-backend, and convex-dashboard. Convex connects to PostgreSQL through the configured POSTGRES_URL. PostgreSQL keeps its database on a volume at /var/lib/postgresql/data; the Convex backend has a separate volume at /convex/data for local files and backend state. The dashboard connects to the backend's public HTTPS URL.

The API listens on port 3210, the dashboard on port 6791, and the backend's separate HTTP-action listener on port 3211. Keep the service URLs, database references, and volume mounts configured by the template.

Admin dashboard access

  1. Deploy the services and confirm PostgreSQL and the backend are running.
  2. Use Railway SSH to connect to convex-backend. From /convex, run ./generate_admin_key.sh.
  3. Keep the complete administrator key private. Open the public convex-dashboard URL and use that key to sign in.
  4. In your application project's private .env.local, set CONVEX_SELF_HOSTED_URL to the backend HTTPS URL and CONVEX_SELF_HOSTED_ADMIN_KEY to the administrator key.
  5. Run npx convex dev from your application project to deploy functions. Configure your frontend's Convex client with the backend HTTPS URL, never the administrator key.

The backend API also supports HTTP actions under /http. For an application route registered as /sendEmail, use the backend HTTPS URL followed by /http/sendEmail. If you configure a separate public domain targeting port 3211, set CONVEX_SITE_ORIGIN to that domain and call routes without the /http prefix.

Common Use Cases

Use this stack for applications with reactive queries, transactional mutations, realtime subscriptions, and HTTP actions. The dashboard lets administrators inspect data, deployed functions, and application logs. Deploy your frontend application separately.

Dependencies for Convex & Postgres - Official Hosting

This deployment requires PostgreSQL 17, the official Convex backend and dashboard container images, and persistent Railway volumes for both PostgreSQL and the Convex backend. All three services and both volume mounts are included in the template. You also need Railway CLI access to generate an administrator key and the Convex CLI in your application project to deploy functions.

Deployment Dependencies

The backend needs its configured PostgreSQL connection, a stable instance name and secret, and access to /convex/data. PostgreSQL requires its database credentials and volume at /var/lib/postgresql/data. The dashboard requires the public backend HTTPS URL. Preserve these settings when restarting or redeploying the services.

Why Deploy Convex & Postgres - Official on Railway?

Run the Convex backend, administration dashboard, and PostgreSQL together in your own project, with configurable service resources and persistent storage. This provides a starting point for self-hosting while keeping infrastructure and application data under your control.

Backups and operating limits

Back up PostgreSQL, the Convex data volume, and instance credentials together. PostgreSQL alone does not contain the files stored on the Convex volume. Keep backups outside the running project and test restoration into a separate instance.

Preserve INSTANCE_NAME and INSTANCE_SECRET across redeployments. Do not publish administrator keys, database passwords, or instance secrets in frontend code or source control. Application functions and HTTP actions must enforce the authorization rules your application requires.

Use one backend replica with the local file volume. This template does not provision a high-availability cluster, S3 storage, or your frontend application. Review upstream migration instructions before upgrading images; rollback may require restoring compatible database and file backups.

Validation

This update clarifies the existing marketplace overview and dependencies; it does not change the saved service configuration. Fresh Railway deployment, dashboard login, application workflows, restart persistence, backup restoration, and resource usage have not been verified as part of this overview update. Complete those checks before production use.

Documentation


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
47
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51