Deploy Hexclave

Self-hosted Hexclave (Stack Auth) 1.0.137: auth, teams, RBAC, user admin

Deploy Hexclave

Just deployed

/var/lib/clickhouse

/var/lib/postgresql/data

Deploy and Host Hexclave on Railway

Hexclave (formerly Stack Auth) is an open-source user infrastructure platform. It gives your apps sign-up and sign-in, OAuth, magic links, passkeys, teams, roles and permissions, API keys and transactional emails, managed from an admin dashboard and used through Hexclave's SDKs or REST API. The server is AGPLv3, the client SDKs MIT.

About Hosting Hexclave

Hexclave's self-hosted server is one container that runs database migrations and a seed script on start, then serves a REST API and a Next.js dashboard on separate ports. It needs Postgres for its data and ClickHouse for analytics, plus a public URL that both the dashboard and your apps can reach. This template runs the official server image pinned by digest, puts a small Caddy proxy in front so the API and dashboard share one Railway domain, runs Hexclave's email and workflow jobs every 10 seconds, and keeps Postgres and ClickHouse data on volumes. You enter one admin email; the password and all secrets are generated.

Common Use Cases

  • Self-hosted authentication and user management for web and mobile apps, instead of Auth0 or Clerk
  • Multi-tenant SaaS with teams, roles, permissions and per-user or per-team API keys
  • Keeping user data on infrastructure you control while using ready-made sign-in components

Dependencies for Hexclave Hosting

  • Postgres (Railway's own database service)
  • ClickHouse (built from the template repository, for analytics)

Deployment Dependencies

Implementation Details

The first deploy takes a few minutes while migrations and the seed run. Then open the Hexclave service's domain and sign in with the admin email you entered and the generated password from the HEXCLAVE_SEED_INTERNAL_PROJECT_USER_PASSWORD variable on the Hexclave service. Public sign-up to the dashboard is off. Point your app's SDK at the same domain:

NEXT_PUBLIC_HEXCLAVE_API_URL=https://YOUR-HEXCLAVE-DOMAIN

For a custom domain, set NEXT_PUBLIC_HEXCLAVE_API_URL and NEXT_PUBLIC_HEXCLAVE_DASHBOARD_URL on the Hexclave service to https://YOUR-DOMAIN. Optional features use Hexclave's own variables: SMTP (HEXCLAVE_EMAIL_HOST and related, or set it in the dashboard), S3 file storage (HEXCLAVE_S3_*), webhooks (HEXCLAVE_SVIX_API_KEY), AI features (HEXCLAVE_OPENROUTER_API_KEY). Without Svix, the logs show a harmless warning about the missing webhook key. Keep HEXCLAVE_SERVER_SECRET unchanged after the first deploy. Updates arrive as an "update available" notice when the template repository pins a new release; read its CHANGELOG and back up Postgres first.

Why Deploy Hexclave 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 Hexclave 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
Keycloak
[2026-11-04] Keycloak with keywind theme + Apple & Discord providers

beuz
754
View Template
lua-protector
Test deployed my project first

trianaq765-cmd's Project
37
View Template
bknd
Feature-rich yet lightweight backend

10