Railway

Deploy Convex (w/ Reverse Proxy)

The backend platform that keeps your app in sync.

Deploy Convex (w/ Reverse Proxy)

Convex

Just deployed

Postgres

postgres:17

Just deployed

/var/lib/postgresql/data

Just deployed

/convex/data

Reverse Proxy (Caddy)

kadumedim/convex-reverse-proxy

Just deployed

Deploy and Host Convex (w/ Reverse Proxy) on Railway

Convex is an open-source reactive database for web apps and LLM-powered apps. This template adds a reverse proxy (Caddy) so you can serve Convex’s backend and HTTP actions from a single HTTPS domain on Railway, without exposing multiple public ports.

Admin Key

On the first successful boot, the Convex Backend will print an admin key in the service logs in a format like:

Admin key: |

Copy that value into the CONVEX_SELF_HOSTED_ADMIN_KEY environment variable and redeploy the Convex Backend service.

If you need to rotate instance credentials (e.g. after changing INSTANCE_SECRET) and want Convex to regenerate the admin key, set:

CONVEX_SELF_HOSTED_ADMIN_KEY=invalid

redeploy the Convex Backend service, then copy the newly printed admin key from logs and set it back.

About Hosting Convex (w/ Reverse Proxy)

Convex self-hosting commonly uses two HTTP listeners: the main backend (typically port 3210) and the HTTP actions / “site” server (typically port 3211). Railway services generally map a single public HTTP domain to a single internal port, so exposing both endpoints cleanly can be tricky. This template deploys Convex Backend + PostgreSQL and places Caddy in front as the only public entrypoint. Caddy terminates HTTPS and routes specific paths (e.g. /.well-known/* and /api/auth/*) to the actions port while routing everything else to the backend port over Railway private networking.

Common Use Cases

  • Full-stack apps that want a single Convex URL (backend + HTTP actions) over HTTPS
  • Auth flows that require HTTP endpoints (e.g. /.well-known/*, /api/auth/*)
  • Webhooks or custom HTTP APIs implemented as Convex HTTP actions

Dependencies for Convex (w/ Reverse Proxy) Hosting

  • PostgreSQL (Convex persistence)
  • Caddy reverse proxy (single public HTTPS entrypoint)

Deployment Dependencies

Implementation Details

HTTP actions are only enabled once you deploy an HTTP router from your app as convex/http.ts (default export). If you don’t need HTTP actions, you can route all traffic to the backend upstream.

Why Deploy Convex (w/ Reverse Proxy) 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 (w/ Reverse Proxy) on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

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

Lucas
View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

Shahed Nasser
View Template
peppermint
Docker-compose port for peppermint.sh

HamiltonAI