Railway

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

Just deployed

/convex/data

/var/lib/postgresql/data

Just deployed

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

ServicePurpose
Convex BackendThe reactive backend — document database, TypeScript function runtime, live queries, and HTTP API, on the main service
Convex DashboardThe web admin UI for browsing data, running functions, and managing your deployment
PostgreSQLBacking 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.

> Self-hosting tradeoffs, honestly: the self-hosted backend includes most cloud features — > dashboard, CLI, live queries, scheduling, vector search. Two caveats: the self-hosted tooling is > newer and less battle-tested than Convex Cloud, and Convex uses a proprietary document model with > no SQL, so migrating away means rewriting your data layer. Choose it for reactivity + data > 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

VariableRequiredDescription
INSTANCE_SECRET✅ RequiredBackend instance secret — change from the repo default before deploying
CONVEX_CLOUD_ORIGIN✅ RequiredPublic URL of your Convex backend on Railway
CONVEX_SITE_ORIGIN✅ RequiredPublic URL for HTTP actions / site
DATABASE_URL✅ Auto-injectedPostgreSQL connection string via Railway reference variable
DASHBOARD_URLRecommendedURL the dashboard is served at
DISABLE_BEACONOptionalSet to disable the anonymous self-host telemetry beacon
PORTAuto-setRailway injects the port automatically

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


Convex vs. Backend Platforms

Convex (Railway)FirebaseSupabasePocketBase
Real-time by default✅ Every query⚠️ Explicit listeners⚠️ Opt-in channels✅ Yes
Data modelDocument (no SQL)NoSQL (Firestore)✅ PostgreSQL/SQLSQLite/SQL
TypeScript end-to-end✅ Yes⚠️ Partial⚠️ Partial❌ Go
Self-hosted / own data✅ Yes❌ Google cloud✅ Yes✅ Yes
Pricing (managed)$25/dev/moPay-per-read$25/project/moSelf-hosted
Vector search built-in✅ Yes❌ No✅ pgvector❌ No
Self-host maturity⚠️ NewerN/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

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.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
112
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
51