---
title: "Deploy Hexclave"
description: "Self-hosted Hexclave (Stack Auth) 1.0.137: auth, teams, RBAC, user admin"
category: "Authentication"
url: https://railway.com/deploy/hexclave
---

# Deploy Hexclave

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

**[Deploy Hexclave on Railway](https://railway.com/template/hexclave)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/hexclave/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Authentication

## Template content

### ClickHouse https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/clickhouse.png

- **Source:** https://github.com/aalfath/hexclave-railway-template

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

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

### Hexclave https://raw.githubusercontent.com/hexclave/hexclave/dev/apps/dashboard/public/hexclave-icon.svg

- **Source:** https://github.com/aalfath/hexclave-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# 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

* Hexclave on GitHub: https://github.com/hexclave/hexclave
* Self-hosting guide: https://docs.hexclave.com/guides/other/self-host
* Template repository: https://github.com/aalfath/hexclave-railway-template

### 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:

```env
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.



## Similar templates

- [Keycloak](https://railway.com/deploy/mSwigX) — [2026-11-04] Keycloak with keywind theme + Apple & Discord providers
- [lua-protector](https://railway.com/deploy/lua-protector) — Test deployed my project first
- [bknd](https://railway.com/deploy/p4nTYL) — Feature-rich yet lightweight backend

Open this page in a browser: https://railway.com/deploy/hexclave
