---
title: "Deploy Convex"
description: "Deploy and Host Convex with Railway"
category: "Storage"
url: https://railway.com/deploy/convex
---

# Deploy Convex

Deploy and Host Convex with Railway

**[Deploy Convex on Railway](https://railway.com/template/convex)**

- **Creator:** ARNO's Projects
- **Category:** Storage
- **Total deploys:** 314

## Template content

### Convex Backend https://dashboard.convex.dev/convex-logo-only.svg

- **Image:** ghcr.io/get-convex/convex-backend:latest
- **Start command:** `sh -c 'mkdir -p "/convex/data/credentials" && echo "$INSTANCE_SECRET" > "/convex/data/credentials/instance_secret" && echo "$INSTANCE_NAME" > "/convex/data/credentials/instance_name" && ([ -z "$CONVEX_SELF_HOSTED_ADMIN_KEY" ] || [ "$CONVEX_SELF_HOSTED_ADMIN_KEY" = "invalid" ]) && ./generate_admin_key.sh || echo "Admin key: $CONVEX_SELF_HOSTED_ADMIN_KEY" && exec ./run_backend.sh'`
- **Health check:** /version
- **Public domain:** Yes

### Convex Dashboard https://dashboard.convex.dev/convex-logo-only.svg

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

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

- **Image:** postgres:17

## Documentation

# 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](https://docs.railway.com/guides/create#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**

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

- [Convex Official Documentation](https://docs.convex.dev/)
- [Convex Self-hosting Guide](https://github.com/get-convex/convex-backend/blob/main/self-hosted/README.md)

---

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

## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/convex
