---
title: "Deploy Hanko"
description: "Passkey-first open-source auth API with login UI, JWT sessions and Postgres"
category: "Authentication"
url: https://railway.com/deploy/hanko-1
---

# Deploy Hanko

Passkey-first open-source auth API with login UI, JWT sessions and Postgres

**[Deploy Hanko on Railway](https://railway.com/template/hanko-1)**

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

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

## Template content

### Hanko https://raw.githubusercontent.com/teamhanko/hanko/backend/v3.1.0/quickstart/public/assets/img/Favicon_256x256.png

- **Source:** https://github.com/aalfath/hanko-railway-template
- **Health check:** /health/ready
- **Public domain:** Yes

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

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

## Documentation

# Deploy and Host Hanko on Railway

Hanko is an open-source authentication and user management API built around passkeys. It handles sign-up, login, sessions, passkeys, passwords, multi-factor authentication, social and SAML sign-in, and issues JWTs your backend can verify. Its drop-in web components, Hanko Elements, add a complete login and profile UI to any frontend.

## About Hosting Hanko

Hanko is a Go service that needs a Postgres database, a secret key for encrypting its token-signing keys, and the URL of the app that embeds it, so passkeys and CORS work. This template builds Hanko v3.1.0 from a GitHub repo, generates its configuration from Railway variables, runs the database migrations on every start and keeps all data in Railway Postgres. A small Caddy proxy serves the public API and a demo page on your Railway domain. The admin API, which has no login of its own, stays on the private network. Email is off until you add an SMTP server.

## Common Use Cases

* Add passkey login, with passwords as a fallback, to a web app or SaaS product
* Run your own user pool and sessions instead of a hosted auth provider
* Issue JWTs that your backend APIs verify against Hanko's JWKS endpoint

## Dependencies for Hanko Hosting

* Postgres (Railway's own, included)
* A frontend that embeds Hanko Elements or the Hanko frontend SDK (a demo page is included)

### Deployment Dependencies

* Hanko source and releases: https://github.com/teamhanko/hanko/releases/tag/backend%2Fv3.1.0
* Hanko documentation: https://docs.hanko.io
* Configuration reference: https://github.com/teamhanko/hanko/wiki/config
* Template repo: https://github.com/aalfath/hanko-railway-template

### Implementation Details

After deploying, open your Railway URL: it redirects to `/demo/`, where you can create an account and add a passkey. To use Hanko in your own app:

```js
import { register } from "@teamhanko/hanko-elements";
const { hanko } = await register("https://YOUR-HANKO-DOMAIN");
```

Then add `hanko-auth` and `hanko-profile` elements to your pages, and set the `APP_URL` variable to your app's URL (for example `https://app.example.com`). Optional variables: `RP_ID` (passkey domain, such as `example.com`), `ALLOWED_ORIGINS` (extra origins, comma-separated), `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASSWORD` and `SMTP_FROM` (turn on email verification, passcode login and password recovery), and `DEMO_PAGE=false`. Without SMTP, users sign up with email and password plus passkeys, and email addresses are not verified. Other Hanko settings can be set with Hanko's own environment variables, for example `ACCOUNT_ALLOW_SIGNUP=false`. Your other Railway services can reach the admin API at `http://hanko.railway.internal:8001`.

## Why Deploy Hanko 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 Hanko 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/hanko-1
