Comparison

Updated October 26, 2026

· ~2 min read

Self-Hosted and Open-Source Auth in 2026: Keycloak vs Zitadel vs Ory vs Better Auth

Keycloak
Zitadel
Ory
Better Auth
Auth.js
Open Source
Identity

There are two very different ways to "own" authentication. One is to run an identity server (Keycloak, Zitadel or Ory) that your applications talk to over OIDC, exactly as they would a hosted provider. The other is a library inside your own application and database (Better Auth, and Auth.js, which the Better Auth team now maintains) where users and sessions are simply tables you own.

Licences shifted here too: Zitadel moved from Apache 2.0 to AGPL 3.0 with its v3 release, offering a commercial licence for those who cannot accept it. Keycloak remains Apache 2.0 and a CNCF project, and Ory's core servers remain Apache 2.0.

At a glance

Keycloak

Zitadel

Ory (Kratos, Hydra)

Better Auth

Kind

Identity server

Identity server

Composable identity services

Library in your app

Licence

Apache 2.0

AGPL 3.0 since v3; commercial option

Apache 2.0

MIT

Protocols

OIDC, OAuth 2, SAML

OIDC, OAuth 2, SAML

OIDC and OAuth 2 (Hydra)

Sessions; OAuth/OIDC provider via plugins

Multi-tenancy

Realms

Organisations, built in

Projects / your design

Organisation plugin

Data lives in

Its database

Its database

Its database

Your application database

Operational weight

High

Medium

Medium

Low — it is part of your app

When self-hosting identity is worth it

Three reasons hold up. Very large user counts, where per-MAU pricing passes the cost of a small team. Data residency or sovereignty requirements a hosted provider cannot meet. And products where identity is part of the product — complex tenant hierarchies, unusual flows, deep integration with your own data model. "Avoiding lock-in" alone rarely is: a self-hosted identity server is its own lock-in, with an upgrade calendar attached.

Which should you use?

Question 1 of 2

Is it one product with one database?

Our verdict

Use a library — Better Auth — when you have one product, one database and want users to be ordinary rows you can query, migrate and back up with everything else; it is the lightest way to own identity. Use Keycloak when you need a full identity server with every protocol and an enormous ecosystem, and can operate a Java application with care. Use Zitadel for a modern, multi-tenant identity server with a strong API, if AGPL or its commercial licence suits you. Use Ory when you want small, composable, API-first services and are comfortable assembling them. In every case you take on patching a security-critical system — budget for it as an ongoing cost, not a setup task.

Related solutions

Multi-Tenant SaaS Platform Architecture

Production-ready SaaS architecture supporting secure multi-tenant isolation and rapid scaling.

4–10 weeks
$25k–$60k
View

SOC 2 Accelerator on AWS

Production-ready AWS architecture and controls designed to pass SOC 2 quickly and safely.

2–6 weeks
$15k–$35k
View

Get an identity architecture you will not have to redo

We work with startups and growing companies on AWS architecture decisions. Tell us about your situation and we will recommend the right approach.

As of October 26, 2026. Provided as is, for general information, and accurate to the best of our knowledge on the date shown. Not legal, compliance, tax, financial or other professional advice. Prices, limits and vendor services change; check current vendor documentation before relying on anything here. Terms of use.