Log inSign up

Your own identity provider with Zitadel

Run Zitadel and PostgreSQL with Docker Compose, start it with start-from-init --masterkey ... --tlsMode external, and set the external domain to id.example.net on port 443. Terminate TLS in Caddy with reverse_proxy h2c://127.0.0.1:8080 so the gRPC and HTTP APIs both work, sign in with the first admin user, then configure SMTP and register OIDC applications from the console.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What is Zitadel and what does it need?

Zitadel is an identity and access management platform: user accounts, organisations, multi-factor login, passkeys, and standards such as OpenID Connect, OAuth 2.0 and SAML for the apps that rely on it. Compared with a forward-auth gate like Authelia, it is a full identity provider that applications integrate with.

  • Server: Ubuntu 24.04 or Debian 12/13 with Docker Engine and the Compose plugin (Docker Engine).
  • Memory: 2 GB runs Zitadel plus PostgreSQL for a test or small user base; 4 GB gives headroom.
  • DNS: one name, for example id.example.net, with A and AAAA records.
  • Master key: exactly 32 characters, used to encrypt sensitive data in the database.

How do you create the Compose project?

Generate the master key and database password first, keep copies offline, then write the Compose file.

sudo mkdir -p /opt/zitadel && cd /opt/zitadel
tr -dc A-Za-z0-9 </dev/urandom | head -c 32 | sudo tee masterkey; echo
openssl rand -hex 16 | sudo tee dbpass
sudo chmod 600 masterkey dbpass

Save the following as /opt/zitadel/docker-compose.yml, replacing the two placeholder values with the contents of those files:

services:
  zitadel:
    image: ghcr.io/zitadel/zitadel:latest
    restart: unless-stopped
    command: start-from-init --masterkeyFromEnv --tlsMode external
    environment:
      ZITADEL_MASTERKEY: PASTE-32-CHARACTER-KEY
      ZITADEL_EXTERNALDOMAIN: id.example.net
      ZITADEL_EXTERNALPORT: 443
      ZITADEL_EXTERNALSECURE: 'true'
      ZITADEL_DATABASE_POSTGRES_HOST: db
      ZITADEL_DATABASE_POSTGRES_PORT: 5432
      ZITADEL_DATABASE_POSTGRES_DATABASE: zitadel
      ZITADEL_DATABASE_POSTGRES_USER_USERNAME: zitadel
      ZITADEL_DATABASE_POSTGRES_USER_PASSWORD: PASTE-DB-PASSWORD
      ZITADEL_DATABASE_POSTGRES_USER_SSL_MODE: disable
      ZITADEL_DATABASE_POSTGRES_ADMIN_USERNAME: postgres
      ZITADEL_DATABASE_POSTGRES_ADMIN_PASSWORD: PASTE-DB-PASSWORD
      ZITADEL_DATABASE_POSTGRES_ADMIN_SSL_MODE: disable
      ZITADEL_FIRSTINSTANCE_ORG_HUMAN_USERNAME: admin
      ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD: Change-Me-Long-1!
    ports:
      - '127.0.0.1:8080:8080'
    depends_on:
      db:
        condition: service_healthy
  db:
    image: postgres:17
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: PASTE-DB-PASSWORD
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 10s
      retries: 5

Replace latest with the release tag you intend to run, so upgrades happen only when you choose. Recent major versions also ship the hosted login pages as a separate zitadel-login container; compare this file with the reference Compose file in the Zitadel self-hosting docs for your version and copy its login service and routing if it has one.

How do you start Zitadel and confirm it runs?

Bring the stack up, watch the initialisation and query the health endpoint.

cd /opt/zitadel
sudo docker compose up -d
sudo docker compose logs -f zitadel     # wait for "server is listening"
curl -s http://127.0.0.1:8080/debug/healthz; echo
sudo ss -tlnp | grep 8080

The first start creates the schema, the default instance and the admin user, which takes a minute. The health check prints ok. After the first successful run you can change the command to start --masterkeyFromEnv --tlsMode external; start-from-init also works on later starts because it skips steps already done.

How do you serve Zitadel over HTTPS with HTTP/2?

Zitadel serves its web console, REST and gRPC APIs on one port and relies on HTTP/2 end to end. Caddy handles this with the h2c upstream scheme:

id.example.net {
    reverse_proxy h2c://127.0.0.1:8080
}
sudo systemctl reload caddy
sudo ufw allow 80,443/tcp
curl -s https://id.example.net/.well-known/openid-configuration | head -c 300; echo

The discovery document lists your issuer as https://id.example.net. If the URLs inside it show port 8080 or plain http, the external domain, port or secure flag in the Compose file are wrong. With Nginx, use grpc_pass grpc://127.0.0.1:8080; inside a server block with listen 443 ssl; and http2 on;, plus a Certbot certificate; plain proxy_pass breaks the gRPC calls the console uses. Caddy installation is in Caddy HTTPS.

How do you sign in for the first time?

Open https://id.example.net/ui/console and log in with the admin user from the Compose file. The full login name has the form admin@zitadel.id.example.net (user name, then the default organisation domain). Zitadel asks you to change the password at once; pick a long passphrase and set up a second factor in the profile. Afterwards remove ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD from the Compose file so the initial password is not left on disk.

How do you set up outgoing mail?

Configure an SMTP provider in the console under the default settings of the instance: host smtp.example.net:587, TLS on, the relay user name and password, and a sender such as id@example.net. Use the test button before saving.

Email verification, password resets and invitations all depend on this. Treat an authenticated relay on port 587 as the reliable path; port 25 is not promised to be open, so ask support with a ticket before you plan direct delivery. The SMTP relay guide walks through SPF and DKIM for the sender.

How do you connect an application with OIDC?

Create a project, add an application, choose the type, and copy the client details into your app.

  1. In the console open Projects, create one named after your service.
  2. Add an application of type Web, choose PKCE or Code depending on whether the app has a server-side secret.
  3. Set the redirect URI, for example https://app.example.net/oauth/callback, and the post-logout URI.
  4. Copy the client ID (and secret) into the app; the issuer is https://id.example.net.

Most frameworks read everything else from the discovery document. Many self-hosted tools, such as Gitea or Grafana, accept these values in their OAuth settings.

How do you back up and upgrade Zitadel?

All state lives in PostgreSQL, so a database dump plus the master key restores the instance.

cd /opt/zitadel
sudo docker compose exec -T db pg_dumpall -U postgres | gzip > /root/zitadel-$(date +%F).sql.gz
sudo nano docker-compose.yml            # raise the zitadel image tag
sudo docker compose pull && sudo docker compose up -d
sudo docker compose logs --tail 50 zitadel

Read the release notes before a major version jump; Zitadel runs migrations on start and some majors change required settings. Without the master key, encrypted fields in the dump stay unreadable, so store the key apart from the backups.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A2-2Zitadel and PostgreSQL for a small user base2 vCPU, 2 GB RAM, 60 GB NVMe$10.80/mo$64.80 for 6 months
A2-4more apps and login traffic2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months
A4-8larger organisations4 vCPU, 8 GB RAM, 180 GB NVMe$28.80/mo$86.40 for 3 months

Questions about Zitadel identity platform

Why does the console show gRPC or "unavailable" errors?

The reverse proxy is speaking HTTP/1.1 to Zitadel. Use h2c:// in Caddy or grpc_pass in Nginx so requests stay on HTTP/2.

Can I change the domain later?

The external domain is stored with the instance. Changing it is possible but involves instance settings as well as the Compose file, so choose the final name before you go live.

How many users can a small server hold?

Users are just rows in PostgreSQL, so storage is rarely the limit. Login traffic and password hashing use CPU; start with 2 vCPU and watch the usage graphs.

Does Zitadel support passkeys?

Yes. Users can register passkeys and security keys, and you can require them in the login policy.

Is Zitadel free to self-host?

The source is published under an open source licence (AGPL 3.0 for recent versions). Read the licence file of the release you deploy.