
Deploy Hexclave | Self-hosted Auth
Auth, teams, and analytics for your app, easily use for multiple products.
Just deployed
/var/lib/postgresql/data
hexclave-cron
Just deployed
hexclave
Just deployed
ClickHouse
Just deployed
Hexclave (self-hosted)
About Hosting Hexclave
Hexclave is an open-source "user infrastructure" platform: authentication, teams, and analytics for your app. This template runs Hexclave's official all-in-one server image (dashboard + API in one container) on Railway, alongside the Postgres and ClickHouse databases it needs.
Common Use Cases
- Running your own auth server for a SaaS product without depending on Hexclave Cloud
- Prototyping or testing Hexclave's authentication, teams, and analytics features in an environment you fully control
- Self-hosting user infrastructure for compliance or data-residency reasons
Dependencies for Hexclave Hosting
- Postgres — stores hexclave's own data (projects, users, teams). Included in this template.
- ClickHouse — stores the analytics data hexclave's dashboard reads. Included in this template.
- hexclave-cron — a small scheduled job that calls hexclave's internal maintenance endpoints (email queue, external DB sync) every 5 minutes over Railway's private network, since the Docker image doesn't run its own scheduler. Included in this template.
Why Deploy Hexclave on Railway?
Railway generates the Postgres and ClickHouse passwords for you and wires every service together automatically, so you get a working auth/teams/analytics backend without hand-managing three separate pieces of infrastructure. Railway's private networking also keeps the cron job's calls to hexclave's internal endpoints off the public internet.
Deploy and Host Hexclave on Railway
Click deploy, then complete the one manual step below — hexclave needs to know its own public URL before its dashboard can finish booting correctly.
After you deploy (required)
- Deploy this template.
- Open the hexclave service -> Settings -> Networking, and generate two public domains: one targeting container port 8101 (the dashboard) and one targeting port 8102 (the API).
- Open the hexclave service -> Variables, and set:
NEXT_PUBLIC_HEXCLAVE_DASHBOARD_URLtohttps://+ the port-8101 domainNEXT_PUBLIC_HEXCLAVE_API_URLtohttps://+ the port-8102 domain
- Redeploy the hexclave service.
- Visit the dashboard URL and sign in with the seeded admin account: the email you set in
HEXCLAVE_SEED_INTERNAL_PROJECT_USER_EMAIL, and the password inHEXCLAVE_SEED_INTERNAL_PROJECT_USER_PASSWORD(check that service's Variables tab if you left it auto-generated).
Known limitations
- Don't let the seed script re-run on restart. This image's seed script currently errors on its second run — an upstream bug where it tries to update a project it's blocked from updating, which crashes the container.
HEXCLAVE_SKIP_SEED_SCRIPTdefaults tofalseso your first deploy seeds correctly; once that first boot succeeds, set it totrueso later restarts don't crash. - Email and webhooks aren't configured out of the box. Password verification codes need
HEXCLAVE_EMAILABLE_API_KEY/SMTP configured for real delivery; webhooks need a Svix key. See hexclave's self-host docs for those variables. - External DB sync runs inline (
HEXCLAVE_EXTERNAL_DB_SYNC_DIRECT=true) instead of through Upstash QStash, which this template doesn't set up. Fine for most self-hosted use; configure QStash yourself if you need queued/retryable delivery.
Template Content
hexclave-cron
curlimages/curl:latesthexclave
stackauth/server:ebe7877NEXT_PUBLIC_HEXCLAVE_API_URL
Public URL for hexclave's API. Generate a domain on this service targeting container port 8102 first (Settings -> Networking), then set this to that domain's https:// URL and redeploy — see README.
NEXT_PUBLIC_HEXCLAVE_DASHBOARD_URL
Public URL for the hexclave dashboard. Generate a domain on this service targeting container port 8101 first (Settings -> Networking), then set this to that domain's https:// URL and redeploy — see README.
HEXCLAVE_SEED_INTERNAL_PROJECT_USER_EMAIL
Email for the admin account seeded on first boot — this is what you'll sign in to the dashboard with.
ClickHouse
clickhouse/clickhouse-server:25.10
