What is Keycloak?
Keycloak is the heavyweight champion of open-source identity: full OIDC and SAML, social logins, user federation (LDAP/AD), fine-grained authorization, admin console, and two decades of enterprise hardening via Red Hat. It is what you deploy when per-MAU pricing on Auth0 or Clerk stops being funny.
This template runs Keycloak in production mode (start, not start-dev) backed by a managed Postgres that Lyngbak provisions and wires automatically - host, port, credentials all injected. TLS terminates at the platform ingress with forwarded headers trusted, so issuer URLs come out as your https domain, which is exactly what OIDC clients require.
All state lives in Postgres; the Keycloak pod itself is stateless and restarts clean. Two variables (bootstrap admin username/password) and you have an identity provider.
What you get
- OIDC, OAuth2, and SAML 2.0 - works with every framework’s auth library
- Social login (Google, GitHub, …) and identity brokering
- User federation: LDAP and Active Directory
- Admin console with realms, clients, roles, and flows
- Production mode behind TLS ingress; correct https issuer URLs
- Managed Postgres auto-provisioned and auto-wired - stateless Keycloak pod
How it runs on Lyngbak
| Service | Role | Public |
|---|---|---|
keycloak | identity server, production mode (:5000) | yes |
db | Postgres - managed service on Lyngbak, container locally | no |
Before you deploy
KC_ADMIN_USERNAME / KC_ADMIN_PASSWORDbootstrap admin, applied on first start against an empty database
Sizing and billing
Keycloak is RAM-hungry (JVM + Quarkus): 2 GiB is the realistic floor. The managed Postgres adds 1 GiB. CPU matters at login bursts - password hashing is deliberate work.
A resource is a flat monthly price, with RAM and disk add-ons when the stack needs a little more than a tier, and room for your own apps on a larger one. On Usage Billing each service takes the smallest size that fits it and is billed by the second it runs, so a stopped stack stops costing CPU and RAM. Its 5 GiB of volumes cost $0.15 per GiB a month ($0.75/mo) for as long as they exist. One workspace can use both. See pricing
Compared with the managed service
| Service | Plan | Price | Includes |
|---|---|---|---|
| Auth0 | Essentials (B2C) | $70/mo | at 1,000 MAU (from $35 at 500 MAU) - scales with users |
| Clerk | Pro | $25/mo | base + $0.02 per monthly retained user past 50k; SSO connections $75 each |
| FusionAuth | Starter (cloud) | $162/mo | cheapest managed FusionAuth, billed annually |
Identity SaaS prices per user; Keycloak prices per gigabyte. Past hobby scale the curves diverge fast. Prices from each vendor's pricing page, June 2026.
Run it locally first
The same compose file runs with plain Docker Compose. Clone the template source, copy .env.example to .env, and run docker compose up -d.
Questions
How does self-hosted Keycloak compare to Auth0 pricing?
Auth0’s paid plans price per monthly active user and climb steeply past the entry tiers. Keycloak on this template has no per-user pricing: unlimited users, realms, and clients, and you pay for the compute it reserves. The trade is operating it yourself - which this template reduces to a deploy.
Is this production-mode Keycloak or a dev toy?
Production mode: kc start with a real Postgres, proxy headers configured for the platform’s TLS ingress, and correct https issuer URLs. start-dev appears nowhere in this template.
Where is Keycloak’s state stored?
Entirely in the managed Postgres (realms, users, clients, sessions config). The Keycloak pod is stateless - redeploys and restarts are uneventful, and the database gets the platform’s managed-service treatment.
Can I use Keycloak for SSO across my apps?
Yes - that is its core job. Create one realm, register each app as an OIDC client, and every standard auth library (NextAuth, Spring Security, Django, Rails) points at your realm’s well-known endpoint.