---
title: "Deploy Convex & Postgres - Official"
description: "Convex is the open-source reactive database for app developers + Postgres."
category: "Other"
url: https://railway.com/deploy/convex-and-postgres-official
---

# Deploy Convex & Postgres - Official

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

**[Deploy Convex & Postgres - Official on Railway](https://railway.com/template/convex-and-postgres-official)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/convex-and-postgres-official/manifest.json

- **Creator:** orenaksakal
- **Category:** Other
- **Total deploys:** 120

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** postgres:17

### convex-backend

- **Image:** ghcr.io/get-convex/convex-backend:latest
- **Public domain:** Yes

### convex-dashboard

- **Image:** ghcr.io/get-convex/convex-dashboard:latest
- **Public domain:** Yes

## Documentation

# 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.

- [Official Convex backend image](https://github.com/get-convex/convex-backend/pkgs/container/convex-backend)
- [Official Convex dashboard image](https://github.com/get-convex/convex-backend/pkgs/container/convex-dashboard)
- [Official PostgreSQL image](https://hub.docker.com/_/postgres)
- [Convex self-hosting documentation](https://github.com/get-convex/convex-backend/tree/main/self-hosted)

## 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

- [Convex application documentation](https://docs.convex.dev/home)
- [Convex with PostgreSQL or MySQL](https://github.com/get-convex/convex-backend/blob/main/self-hosted/advanced/postgres_or_mysql.md)
- [Railway self-hosting instructions](https://github.com/get-convex/convex-backend/blob/main/self-hosted/advanced/railway/README.md)


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/convex-and-postgres-official
