---
title: "Deploy Convex — Self-Hosted Reactive Backend & Firebase Alternative"
description: "Self-host Convex: reactive backend with live queries. No per-dev cloud fee."
category: "AI/ML"
url: https://railway.com/deploy/convex-reactive-backend
---

# Deploy Convex — Self-Hosted Reactive Backend & Firebase Alternative

Self-host Convex: reactive backend with live queries. No per-dev cloud fee.

**[Deploy Convex — Self-Hosted Reactive Backend & Firebase Alternative on Railway](https://railway.com/template/convex-reactive-backend)**

- **Creator:** SilverBanana
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

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

- **Image:** get-convex/convex-backend:latest

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

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

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

- **Image:** get-convex/convex-dashboard:latest

## Documentation

# Deploy and Host Convex on Railway

Convex is the open-source reactive backend that makes real-time apps simple — a document
database, TypeScript server functions, and automatic live-updating queries in one platform.
Built by former Dropbox engineers and backed to a $10.5B valuation, Convex makes every query a
live subscription by default: change data anywhere, and every connected client re-renders
instantly, with no WebSocket plumbing or sync logic. Schema, mutations, and auth are pure
TypeScript with end-to-end type safety.

Convex Cloud Pro is $25/developer/month with usage-based billing. This template self-hosts the
open-source Convex backend on Railway for flat compute (~$10–15/month) — the same reactive
backend, dashboard, and CLI, on infrastructure you own, for teams that want data sovereignty or
cost control.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Convex Backend** | The reactive backend — document database, TypeScript function runtime, live queries, and HTTP API, on the main service |
| **Convex Dashboard** | The web admin UI for browsing data, running functions, and managing your deployment |
| **PostgreSQL** | Backing store for the self-hosted backend (Convex self-hosted uses SQLite or Postgres; Postgres is the production choice) |

All services connect over Railway's private network. Self-hosted Convex includes most features of
the cloud product — the dashboard, the CLI, live queries, scheduled functions, and vector search.
Point the Convex CLI at your Railway deployment and develop exactly as you would against the cloud.

---

## About Hosting Convex

Convex is a reactive backend: instead of SQL against a database, you write TypeScript functions
Convex runs, and its query engine tracks dependencies so that when data changes, subscribed
clients update automatically. Running the open-source backend means the backend service, the
dashboard, a database (SQLite or Postgres), and HTTPS — this template wires all of it on Railway.

&gt; **Self-hosting tradeoffs, honestly:** the self-hosted backend includes most cloud features —
&gt; dashboard, CLI, live queries, scheduling, vector search. Two caveats: the self-hosted tooling is
&gt; newer and less battle-tested than Convex Cloud, and Convex uses a proprietary document model with
&gt; no SQL, so migrating away means rewriting your data layer. Choose it for reactivity + data
&gt; ownership; if you need Postgres/SQL, Supabase fits better.

Typical cost: **~$10–15/month** on Railway for the backend, dashboard, and Postgres. Convex Cloud
Pro is $25/developer/month plus usage. Self-hosting removes the per-developer fee and keeps your
data on infrastructure you control.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — the Convex backend, dashboard, and Postgres build automatically
2. Set your `INSTANCE_SECRET` and generate an admin key (change both from the repo defaults)
3. Set the backend and dashboard URLs to your Railway public domains
4. Point the Convex CLI at your deployment: `npx convex dev --url `
5. Deploy your TypeScript functions and open the dashboard to browse data and live queries

No sync logic to write. No WebSocket setup. No cloud lock-in.

---

## Common Use Cases

- **Self-hosted alternative to Firebase for real-time apps** — reactive queries that update
  clients automatically, without Firestore's proprietary listener API or pay-per-read pricing
- **Real-time collaborative and multiplayer features** — live cursors, shared documents, and
  presence come naturally when every query is a subscription by default, with far less code
- **TypeScript-first full-stack backend** — define schema, queries, mutations, and auth in pure
  TypeScript with end-to-end type safety; change a field and your IDE flags every affected line
- **AI and agent backends** — built-in scheduling, actions, and vector search make Convex a
  natural backend for LLM-powered apps that need real-time state and background jobs
- **Live dashboards and chat** — anything where clients must stay in sync in milliseconds is far
  less code on Convex than bolting real-time onto a traditional backend

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `INSTANCE_SECRET` | ✅ Required | Backend instance secret — change from the repo default before deploying |
| `CONVEX_CLOUD_ORIGIN` | ✅ Required | Public URL of your Convex backend on Railway |
| `CONVEX_SITE_ORIGIN` | ✅ Required | Public URL for HTTP actions / site |
| `DATABASE_URL` | ✅ Auto-injected | PostgreSQL connection string via Railway reference variable |
| `DASHBOARD_URL` | Recommended | URL the dashboard is served at |
| `DISABLE_BEACON` | Optional | Set to disable the anonymous self-host telemetry beacon |
| `PORT` | Auto-set | Railway injects the port automatically |

&gt; Change `INSTANCE_SECRET` and generate a fresh admin key — never ship the repo defaults to
&gt; production. Set the origin URLs to your Railway domains so the CLI, dashboard, and client
&gt; libraries connect correctly. Verify exact variable names against the current Convex self-hosting
&gt; guide, as the self-hosted tooling evolves quickly.

---

## Convex vs. Backend Platforms

| | Convex (Railway) | Firebase | Supabase | PocketBase |
|---|---|---|---|---|
| **Real-time by default** | ✅ Every query | ⚠️ Explicit listeners | ⚠️ Opt-in channels | ✅ Yes |
| **Data model** | Document (no SQL) | NoSQL (Firestore) | ✅ PostgreSQL/SQL | SQLite/SQL |
| **TypeScript end-to-end** | ✅ Yes | ⚠️ Partial | ⚠️ Partial | ❌ Go |
| **Self-hosted / own data** | ✅ Yes | ❌ Google cloud | ✅ Yes | ✅ Yes |
| **Pricing (managed)** | $25/dev/mo | Pay-per-read | $25/project/mo | Self-hosted |
| **Vector search built-in** | ✅ Yes | ❌ No | ✅ pgvector | ❌ No |
| **Self-host maturity** | ⚠️ Newer | N/A | ✅ Mature | ✅ Mature |
| **Open source** | ✅ FSL/Apache | ❌ No | ✅ Apache | ✅ MIT |

---

## Dependencies for Convex Hosting

- Railway account — Hobby plan (~$10–15/month) for the backend, dashboard, and Postgres
- Node.js and the Convex CLI locally to develop and deploy your TypeScript functions
- A frontend (React, Next.js, Vue, Svelte, React Native) using Convex's client libraries

### Deployment Dependencies

- [Convex Backend GitHub](https://github.com/get-convex/convex-backend) — open-source backend source
- [Convex Self-Hosting Guide](https://docs.convex.dev/self-hosting) — deployment instructions
- [Convex Discord #self-hosted](https://convex.dev/community) — community support for self-hosting

### Implementation Details

This template deploys the open-source Convex backend with its dashboard and a PostgreSQL store
over Railway's private network (Convex self-hosted supports SQLite or Postgres; Postgres is the
production choice). The backend runs your TypeScript functions and the reactive query engine.

Change `INSTANCE_SECRET` and generate a new admin key before production — repo defaults aren't safe
to ship. Set `CONVEX_CLOUD_ORIGIN` and `CONVEX_SITE_ORIGIN` to your Railway domains. Disable the
anonymous telemetry beacon with `DISABLE_BEACON` if you prefer. Since the self-hosted tooling is
newer, pin a known-good version and check the self-hosting guide when upgrading.

---

## Frequently Asked Questions

**How does self-hosted Convex compare to the cloud version?**
The self-hosted open-source backend includes most cloud features — the dashboard, CLI, live
queries, scheduled functions, and vector search. The main differences: the self-hosted deployment
tooling is newer and less battle-tested than Convex Cloud, and you take on updates, backups, and
scaling yourself. You gain data ownership and remove the per-developer fee.

**How much does it save versus Convex Cloud?**
Convex Cloud Pro is $25/developer/month plus usage-based components. Self-hosting on Railway is
~$10–15/month flat for the stack regardless of team size, so it pays off for multi-developer teams
and for anyone who needs the data on their own infrastructure.

**Does Convex use SQL?**
No — Convex uses a proprietary document model with typed schemas, indexes, and relationships
defined in TypeScript, not SQL. That's a deliberate tradeoff: it enables the reactive query engine,
but migrating away means rewriting your data layer. If you need Postgres/SQL, Supabase is the
better fit; if real-time reactivity is your core requirement, Convex is more natural.

**What makes Convex good for real-time apps?**
Every Convex query is a live subscription. The engine tracks which data each query reads, and when
that data changes it reruns the query and pushes updates to all subscribed clients — automatically,
with no WebSocket code or sync logic. Collaborative and multiplayer features become far less code
than bolting real-time onto a traditional backend.

**Do I lose my data if Railway redeploys?**
No. Application data lives in the PostgreSQL store, which persists across redeploys. Your
TypeScript functions are deployed via the Convex CLI and versioned in your own codebase.

**Is the self-hosted version production-ready?**
It runs the same core backend as the cloud, but the self-hosting *tooling* is newer, so operations
(upgrades, backups, scaling) are less turnkey. Good for teams comfortable owning infrastructure;
if you want zero-ops, Convex Cloud's free tier may suit better.

---

## Why Deploy and Host Convex on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your
infrastructure so you don't have to deal with configuration, while allowing you to vertically and
horizontally scale it.

By deploying Convex on Railway, you get an open-source reactive backend — document database,
TypeScript functions, live-updating queries, and vector search — with the dashboard and CLI
included, on infrastructure you own at ~$10–15/month flat, no per-developer fee.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

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