Files
ZitPlane/docs/ARCHITECTURE.md
T

6.3 KiB

ZitPlane architecture (proposed)

Responsibility

ZitPlane is a central identity and account-management platform, not a billing or SaaS business backend.

  • ZITADEL (official Go server): identities, authentication, OIDC, security policies, projects, admin console.
  • Login V2 (customized upstream Next.js app): branded signup, sign-in, recovery and challenge screens.
  • Account portal (P04 separate Next.js App Router source at users/ui/): standard ZITADEL OIDC + Auth.js, server-protected overview/read-only profile/security navigation, user-scoped API. Real user editing and security-device management are not implemented yet; CI and live integration remain pending.
  • PostgreSQL: persistent ZITADEL storage. Do not expose directly to the Internet.
  • Coolify / Compose: one Git deployment definition, isolated services and persistent volumes.

Production routing (target, not configured)

  • https://auth.vib.tools/: ZITADEL OIDC discovery, OAuth/OIDC, API and management console; login routes must explicitly proxy to Login V2.
  • https://account.vib.tools/: independent account portal using standard OIDC login.
  • Clean /login is a target route requiring matched login app routes, ZITADEL Login Base URI and proxy; never assume a proxy rewrite alone is sufficient.
  • Verify reverse-proxy h2c/HTTP2 needs, cookies, OIDC callbacks, CSRF and WebAuthn relying-party/domain behavior before release.

Source ownership

  • Do not copy the complete ZITADEL backend Go tree into core/backend/zitadel/; use immutable/version-locked official image and maintain deployment config here.
  • P03 imported the official v4.20.4 Login V2 source at upstream commit 384bb9ec96b501ad39dc232ee2061a40fe180bbd, including apps/login, packages/zitadel-client, packages/zitadel-proto, proto and workspace files under auth/ui/v2/. Source build and runtime integration await future CI/P05 approval; see docs/P03-SOURCE-IMPORT.md.
  • Share only presentation components/tokens across login and account projects unless explicitly approved. No shared browser-side admin credentials.

Environments

  • Development: local Docker PostgreSQL/ZITADEL, non-production test identities; Next.js hot reload; optional mock-only UI preview.
  • Production: dedicated persistent PostgreSQL, protected secrets, hardened ZITADEL configuration, built Next.js apps, HTTPS, backups, health checks and controlled updates.
  • Local dev settings and production config must never share databases, master keys or user records.
  • A production Docker stack is not automatically secure simply because NODE_ENV=production is set.

SaaS applications

Each external SaaS authenticates through ZITADEL using OIDC authorization code + PKCE when appropriate and validates tokens on its backend. Each app owns its own billing, subscription, business database, API keys and entitlement enforcement. Key users by stable issuer + subject identity, not email.

P05-OIDC-07 — proposed production two-origin trust architecture (not live)

https://auth.vib.tools is the proposed single ZITADEL OIDC issuer with TLS 443 edge, exact /ui/v2/login/** route to private imported Login V2 port 3000 and remaining OIDC discovery/API//ui/console/** routed via h2c HTTP/2 to official ZITADEL Go port 8080; neither internal server nor PostgreSQL port 5432 is host published. https://account.vib.tools is the proposed distinct relying-party HTTPS origin, not a second issuer, with registered /api/auth/callback/zitadel; issuer/Host/forwarded headers must be canonical and scrubbed at edge, and production session/cookies tested. Private Login IAM_LOGIN_CLIENT token, separate break-glass IAM_OWNER, 32-byte master-key custody, encrypted PostgreSQL restore and immutable images are mandatory security/recovery design gates. This is documentation-only, not validated DNS/TLS or runtime. Detailed source/evidence/next CI-only static dry-run proposal: notes/P05-OIDC-07.md, docs/P05-OIDC-07.md.

P05-OIDC-08 — intended synthetic routing topology (not live or accepted)

The dedicated deployment/production-contract/routing-policy.json models exactly one proposed https://auth.vib.tools OIDC issuer: Login prefix /ui/v2/login → synthetic private zitadel-login:3000, Console /ui/console and API / → synthetic zitadel-api:8080 requiring h2c, plus https://account.vib.tools → synthetic private Account service, exact confidential OIDC callback. Strict Host reject and trusted Forwarded strip/replace are declarative policy values, not running proxy behavior. The associated Compose service images resolve to reserved synthetic.invalid, replicas are zero, no ports or real credentials. Run #101 parsed Compose successfully but normalized validation failed; full 25 negative checks not run, so policy gate NOT ACCEPTED. Real production DNS/SSL infrastructure remains unverified. See notes/P05-OIDC-08.md.

P05-OIDC-09 — production release preflight update (not deployed)

Read-only review at d3ee3fa4de62463c53d5213c532d097278f928c6 distinguishes development-only backend Compose and non-deployable synthetic contract from a real production ingress. Proposed public single issuer https://auth.vib.tools TLS443: Login prefix /ui/v2/login/** private 3000; Console /ui/console/** and ZITADEL API/discovery private Go 8080 h2c; Account relying party https://account.vib.tools exact /api/auth/callback/zitadel. Reject untrusted Host and forwarded headers, no public DB/API ports or plaintext login. Run #105 PASSED 48/48 security-negative static policy cases for the synthetic-only config; Run #99 accepted real custom Login/Account OIDC only on disposable localhost. All real-domain DNS/TLS/issuer/cookies, signed images, masterkey/PAT/IAM_OWNER, encrypted restore, Admin Console/MFA/SSO and production monitoring remain LIVE NOT VERIFIED/BLOCKED. Account package lock is now tracked, but a release OCI image is absent. 13 narrowly separated proposed phase boundaries and operator stops: preflight and forensic evidence. Historical sections above preserve original as-of-date findings and should not be mistaken for latest Run #105 status.