Deploy Hanko

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

Deploy Hanko

/var/lib/postgresql/data

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

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:

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.


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