---
title: "Decisions, corrections and open questions"
description: "Decision records, corrections to the discussions, and unknowns."
---

## Decision records

| ID | Decision | Status | Rationale / consequences |
|---|---|---|---|
| ADR-001 | Control plane in **TypeScript/Node** (Fastify, pg-boss, Pulumi Automation API, TanStack Start console) | **Accepted** (D1) | Matches Pulumi Automation API and console; supersedes Go CP of the discussions. go-meet stays Go. |
| ADR-002 | Chat = **Tuwunel (Matrix)** per tenant | **Proposed — confirm** | `AGENTS.md` still lists Rocket.Chat; Matrix discussion is the deeper one. Affects DB design (Mongo vs RocksDB) |
| ADR-003 | **Zitadel**, single multi-tenant instance, org per tenant | **Accepted** (D3) | Replaces Keycloak. Dedicated instance for Tier-1 only. |
| ADR-004 | **Infisical shared**, project per trust scope (`fortspace-platform`, `fortspace-broker`, `tenant-<slug>`) + machine identity per tenant | **Accepted** (D2, amended) | Per-tenant Infisical too heavy. Free-tier Infisical lacks custom roles/path-scoped access, so trust scopes are separated by project using built-in roles only. Production may use Enterprise path-scoped roles instead (Q-15). |
| ADR-005 | Coolify project per tenant (`fortspace-tenant-<slug>`) + `fortspace-platform` + `fortspace-data-pool` | **Accepted** (D4, renamed 2026-11-20) | Atomic teardown, clear scope. The `fortspace-` prefix on every project we manage keeps them apart from the pre-existing `fortspace` project; `fortspace-tenant-` is reserved for tenant projects only (hence `fortspace-data-pool`, not `…-tenant-pool`, which would collide with slug `pool`). |
| ADR-006 | LiveKit shared; **token broker** signs exact-room tokens; tenants never hold the API secret | **Proposed** | LiveKit has no prefix grants or per-key authZ. Cost: CP on the join path. |
| ADR-007 | Webhook **router** in CP re-signs to tenant go-meet | **Proposed** | One LiveKit webhook stream; custom per-egress callback not relied on. |
| ADR-008 | **Bucket per tenant** + scoped key; presigned URLs; lifecycle expiry | **Accepted** | Hard boundary, instant erase. |
| ADR-009 | Encryption: SSE-S3 first; per-tenant keys via a RustFS-supported KMS later | **Proposed** | Infisical is not a documented RustFS KMS backend. |
| ADR-010 | DB per tenant on sharded Postgres pool; separate core Postgres | **Accepted** | Hard boundary; blast radius per shard. |
| ADR-011 | Pulumi stack per tenant, state in Postgres backend, dynamic providers over adapters | **Accepted** (2026-11-20), **phase scope only** | Single lifecycle model; adapters keep Coolify authoritative for runtime. **This phase: Pulumi owns the Coolify stack of a tenant only** (project, environment, compose service, env vars, tags), behind the existing `Orchestrator` port; Zitadel, Infisical, RustFS and the shard stay saga steps and move into the Pulumi program in a later phase (Zitadel and Infisical did: ADR-034). State in the Postgres DIY backend (ADR-022), encrypted with a passphrase held in Infisical (ADR-021). See [04](/architecture/control-plane#provisioner). |
| ADR-012 | go-meet per tenant (container), Redis per tenant | **Accepted** | ~20 MB, process isolation. |
| ADR-013 | Persistent in-call chat via Matrix room; LiveKit data channels not used for chat | **Proposed** | Single text record; guest bridge open (Q-06). |
| ADR-014 | Orchestrator references stored generically (`orchestrator_type`, `resource_id`) | **Accepted** | Coolify → Dokploy/K8s is an adapter. |
| ADR-015 | Job queue = **pg-boss** on core Postgres; hand-rolled `SKIP LOCKED` queue and `pg_partman` rejected | **Accepted** | Gives retries, expiry of crashed jobs, dead letters, schedules and retention for free; `pg_partman` needs an extension and our job volume is tiny. Queue is execution only, `provisioning_runs` is the record. Per-tenant serialization uses queue policy **`stately`** (verified: `singleton` limits only *active* jobs; `exclusive` would also forbid enqueueing while one is active). Details in [04](/architecture/control-plane#job-queue-pg-boss). |
| ADR-016 | **Drizzle ORM + drizzle-kit generated SQL migrations**; replaces "Kysely or Drizzle" and node-pg-migrate | **Accepted** | One schema source in TS, reviewed SQL committed and applied by Drizzle's migrator. Pinned to the stable 0.45 line (1.0 is still a release candidate). |
| ADR-017 | **Console is a backend-for-frontend with no DB or Infisical credentials**; it calls the CP API with the operator's token | **Accepted** | Keeps authorization, idempotency and audit in one place (the API). Rejected: shared domain services called directly from console server functions. |
| ADR-018 | Control plane runtime = **Node 26 LTS**, pnpm workspaces, Fastify 5 | **Accepted** | Node 26 is the active LTS (Node 24 is in maintenance). |
| ADR-019 | The tenant-admin **invite is re-sent on every run of the activate step** | **Accepted** (2026-11-20) | Zitadel 4.16 has no read-only "was the invite delivered" probe (`invite_code/resend` is the only one and re-delivers the mail), so the adapter cannot tell an invited admin from a never-invited one. A duplicate invitation is harmless, a lost one blocks the tenant's first login. Rejected: recording "invited" in the step output (trusts our state about a vendor we cannot read back). See [03](/architecture/identity-access#tenant-admin-invitation). |
| ADR-020 | The Coolify provider is the **Terraform provider `coolify-terraform/coolify`**, consumed through Pulumi's **Any Terraform Provider** (the `terraform-provider` bridge) | **Accepted** (2026-11-20) | Verified against Coolify 4.7.6 in a spike: project, environment, compose service, env vars, start, status read, drift detection, reconciliation and destroy all worked ([04](/architecture/control-plane#why-pulumi-and-adapters), control-plane `docs/notes/coolify.md`). Rejected: the `SierraJC/terraform-provider-coolify` named earlier (stale since 2025-08, 65 resources in `coolify-terraform/coolify` 0.1.33), the native `@bambamboole/coolify` provider (not needed, not tested) and a hand-written dynamic provider over the Coolify REST API (last resort, more code to maintain). The bridge adds a pinned plugin to the worker image (~280 MB with the CLI). |
| ADR-021 | **Scoped exception to hard rule 2:** the Pulumi state holds the tenant stack's secrets as **Pulumi secrets**, encrypted with a passphrase secrets provider; the passphrase lives in Infisical and is read by the worker only | **Accepted** (2026-11-20) | Rule 2 forbids secrets in columns. The Pulumi checkpoint is a control-state blob, not a registry column, and the values are ciphertext at rest (`{"ciphertext": "v1:…"}`), so the exception is narrow: **only** the encrypted state rows, the worker's passphrase ref and the `pulumi.secret` inputs carry ciphertext, never plaintext. Job payloads, logs, audit detail, step outputs and the registry keep ids and refs only. See [08](/architecture/data-storage-secrets#pulumi-secrets-the-one-exception-to-no-secrets-in-a-column) and [10](/architecture/security-operations#exceptions-and-known-risks). |
| ADR-022 | Pulumi stack naming: **project `tenant`, stack `<slug>`** (fully qualified `organization/tenant/<slug>`); the Coolify project is `fortspace-tenant-<slug>` | **Accepted** (2026-11-20) | The Postgres DIY backend only accepts the organization literally named `organization`, so `fortspace/tenant/<slug>` is impossible; the Pulumi project name cannot be qualified. The Coolify project keeps the `fortspace-` prefix so it can never collide with the pre-existing `fortspace` project (the guard is the name, not a Coolify permission — see [10](/architecture/security-operations#exceptions-and-known-risks)). See [02](/architecture/tenancy-isolation#naming-conventions). |
| ADR-023 | **OIDC everywhere it is free; superadmin = one role set across systems; no powerful credential at rest** | **Accepted** (2026-11-24) | Every human login goes through Zitadel (cockpit, RustFS console, go-meet, later Tuwunel/Stalwart/pocket-id). Exceptions: **Infisical** (generic OIDC/SAML login is paid, `LICENSE_KEY`) keeps a few local org admins with TOTP, invited by hand in its UI (the invite API refuses machine identities); **Coolify** keeps its local login (it hosts Zitadel, so it must work when Zitadel is down; no Zitadel login configured for now); **Mailpit** is temporary and goes away with the prod EU relay. A **superadmin** = `IAM_OWNER` + cockpit `operator` + `superadmin` on the separate project `Fortspace Admin` (+ Infisical org admin). Admin UIs get their own project with `authorizationRequired`, never the tenant-delegable `Fortspace` project, because tools that cannot read Zitadel's object-shaped roles claim (RustFS `ROLE_POLICY=consoleAdmin`) grant everything to whoever gets in. MFA is enforced on the platform org. The first-instance `bootstrap-admin` PAT (valid to 2099) is revoked at the end of the first setup run; later runs use the `platform-setup` machine key in Infisical. Rejected: keeping the PAT on the volume, RustFS console behind the root key. See [03](/architecture/identity-access#oidc-coverage-and-superadmins). |
| ADR-024 | The **registry login of the Coolify host is a base-stack resource** (`base:registry` + secret `base:registryToken`, a classic PAT with `read:packages`); images are pinned by `sha-<short>` or release tag | **Accepted** (2026-11-25) | The control plane's own images are private GHCR packages, so a login applied by the control plane worker would come after the first pull. GHCR takes no fine-grained PAT. `latest` exists only after a release tag; `edge` moves on every push. See [09](/architecture/infrastructure#the-control-planes-images-and-the-registry-login). |
| ADR-025 | **Core Postgres runs with TLS; clients encrypt without verifying** (`no-verify` for node-postgres, `require` for libpq/pgx); the switch is made in the Coolify UI and the stack reads the real state | **Accepted** (2026-11-25) | Coolify's API refuses `enable_ssl`, and its CA is not in the apps' trust store; node-postgres turns `require` into a verified connection. The traffic stays encrypted on the host; certificate verification is the accepted gap. See [08](/architecture/data-storage-secrets#transport-encryption-core-cluster). |
| ADR-026 | **Prod LiveKit gets its own public port pair, TCP 7885 / UDP 7886** (host 7883 / 7884, container 7881 / 7882) | **Accepted** (2026-11-25) | frp routes TCP/UDP by port, never by domain, and the old `office-suite` prototype keeps 7881 / 7882. Hosts ports (`base:livekitHostPorts`) and the ports clients are told (`base:livekitPublicPorts`) are separate settings. Not yet verified with a real call. See [09](/architecture/infrastructure#edge-and-ports-diagram-10). |
| ADR-027 | **Mailpit's UI is protected by `traefikoidc` against an external IdP (pocket-id), not Zitadel; its OIDC secrets are baked into the service compose** | **Accepted** (2026-11-25), temporary | The mails contain Zitadel's own login codes, so Zitadel must not gate them. The plugin is configured by Docker labels and Coolify does not interpolate labels, so the secrets cannot be Coolify variables; the compose is a Pulumi secret (encrypted in the state), readable on the host in Coolify's database and in the container labels. An empty `allowedUsers` is refused by the plan (it would admit every account of the IdP). Goes away with the prod EU SMTP relay. See [03](/architecture/identity-access#oidc-coverage-and-superadmins), [10](/architecture/security-operations). |
| ADR-028 | **Zitadel runs v4.20.6 with a dedicated `ZITADEL_SESSION_COOKIE_SECRET`** for the Login UI; the databases are dumped by hand before an upgrade | **Accepted** (2026-11-25) | v4.16.0 missed the three advisories fixed in v4.19.2, among them `GHSA-jh92-5mrj-p2w2` (high): account takeover through the unsigned Login v2 session cookie — we run Login v2. The dedicated secret decouples the cookie signing key from the login-client PAT, so rotating the PAT no longer signs everyone out; it is generated by the stack and escrowed like the masterkey. The upgrade runs Zitadel's DB migrations, so a `pg_dump` of every database comes first (there is still no automated backup). See [03](/architecture/identity-access#the-login-ui-signs-its-sessions), [12](/architecture/bastion-runbook#28-escrow-and-backup-do-it-now-not-later). |
| ADR-029 | **The base stack's Pulumi state lives in an S3-compatible object storage bucket in the EU** (Scaleway `nl-ams`), not in the platform and not on a workstation | **Accepted** (2026-11-25) | The stack cannot keep its state in the Postgres and the RustFS it creates (chicken and egg), and the local file backend made the workstation a single point of failure. The bucket is outside the platform, in the EU (data sovereignty), with versioning (a bad `up` can be rolled back) and bucket-scoped keys (one for operators, one for CI). The encryption does not change: the passphrase secrets provider still encrypts the secrets in the state, the bucket holds ciphertext. Rejected: **Pulumi Cloud** (a US SaaS), the platform's own Postgres or RustFS (created by this stack), the state in git (two writers, and the whole state in the repository). The local file backend stays as the pre-migration snapshot; `scripts/pulumi.sh` refuses the prod stack on it. See [12](/architecture/bastion-runbook#4-state-and-deploys). |
| ADR-030 | **A merge on the control plane's `main` deploys to prod by itself**; the cross-repository hop uses a **GitHub App** installed on the bastion repository only, the deploy runs in the `prod` GitHub Environment and applies the **whole plan** | **Accepted** (2026-11-25) | The control plane's images are published per commit (`sha-<short>`); the base stack pins `base:controlPlaneTag`, so the deploy is a one-line config change. GitHub must reach the state, hence ADR-029. The App (not a PAT) is the identity that crosses the repository border: it can dispatch to bastion and nothing else, and its token is short-lived. The deploy runs with the platform's credentials (Coolify token, passphrase, bucket key) — a compromised runner means a compromised platform, so the Environment is restricted to `main` and can require a reviewer. The **whole plan** is applied, not only the control plane: the stack is the only writer of the base infrastructure and a partial apply would leave state and platform apart; the consequence (a drift in the base stack is deployed too) is accepted and visible in the run log. The workflow verifies afterwards (`/healthz`, the image Coolify holds) and commits the tag bump to `main`. **Amended 2026-11-27:** a merge on the bastion's own `main` deploys too (same workflow on `push`, tag untouched, markdown-only changes excluded), because the stack changes without the control plane; it always applies the latest `main`, and there is no PR preview since the prod secrets exist only for `main`. See [12](/architecture/bastion-runbook#43-the-automatic-deploy-merge--prod), [10](/architecture/security-operations). |
| ADR-031 | **Two frontends over one control-plane API: `cockpit` (operators) and `console` (tenant admins), plus a separate static website; webhooks go through the edge process** | **Accepted** (2026-11-27) | One API keeps one registry, state machine, idempotency store and audit log; its surfaces (`/admin/v1`, `/tenant/v1`, `/internal/v1`, later `/public/v1` for signup) are the boundary, and **each surface accepts only tokens issued to its own OIDC client** (audience check). Two separate apps rather than one with role-based sections: the cockpit can sit behind an IP allowlist and accept only the platform org (project `Fortspace Cockpit`, ADR-032), the tenant console is customer-facing and released often, sessions and CSP are per host, and a role-check bug cannot expose operator screens (hard rule 3). Shared code goes in packages (ui, schemas, login/session). **Naming:** the existing app and image are renamed `cockpit` (`apps/cockpit`, `@fortspace/cockpit`, `control-plane-cockpit`, service `cp-cockpit`, env `COCKPIT_*`, Zitadel app `admin-console` → `cockpit`, Infisical `/platform/cockpit`); `console` / `control-plane-console` is reserved for the tenant console. The marketing site and signup page live in their own repo with no credentials; signup calls a rate-limited, unauthenticated `/public/v1` that creates a *pending* record (no provisioning before email verification and a payment method or operator approval). Webhooks from LiveKit, RustFS and the payment provider run in the edge/broker process, not in the admin API. Operators reach a tenant's view through an audited support session, not by logging into the console. Open: tenant user management vs hard rule 8 (Zitadel management from the console), billing module (Q-10), custom domains. Rejected: one app with sections per role, two APIs. **Amended by ADR-032:** the cockpit has its own project `Fortspace Cockpit`, not `Fortspace Admin`. |
| ADR-032 | **One Zitadel project per product; each API accepts only its own project's audience; products re-authorize silently instead of exchanging tokens; one issuer, custom domains for products only** | **Accepted** (2026-11-27); implemented and verified in dev with a two-tenant end-to-end test, not yet rolled out to prod. **Amended** (2026-12-02): the login gate (below), verified in dev, applied to prod by the base stack when merged | Every product handles its **own** session and gets tokens for **its own audience**. A Zitadel project is an audience (its id is in `aud`), a role set and a grant unit; two products share a project only if all three are equal. Four projects, all owned by the platform org with `projectRoleAssertion`, `authorizationRequired` and `projectAccessRequired` on (the login gate was relaxed by the amendment below): `Fortspace Cockpit` (granted to nobody; role `operator`; app `cockpit`; accepted by `/admin/v1`), `Fortspace Admin` (nobody; `superadmin`; `rustfs-console` and other role-blind tools), `Fortspace Console` (every tenant org; `tenant_admin`; app `console`, planned; `/tenant/v1`, planned) and `Fortspace Workspace` (every tenant org; `member`, `team_lead`, `tenant_stack`; apps `meet-<slug>`, later `chat-<slug>`; go-meet, Tuwunel and `/internal/v1`). The old project `Fortspace` goes away. Each API surface has its own verifier and accepts only its project's audience, so a token for one surface is a 401 (not a 403) on another; roles are read only from the project-specific claim `urn:zitadel:iam:org:project:<id>:roles`. The tenant stack is identified by `sub` (`tenants.zitadel_stack_user_id`), not by role: a human holding `tenant_stack` is refused. **SSO between products** is a silent re-authorization (`prompt=none`) that yields the product's own tokens; **no RFC 8693 token exchange**; products integrate server to server with their own identity. go-meet checks the tenant itself (resource-owner claim equals its org, a Workspace role granted in that org) at login and on refresh: the `org:id` scope only routes the login, the claim check is the control (fixes a globex user logging into acme's meet). The first tenant admin gets `tenant_admin` on Console and `member` on Workspace. **Custom domains: one issuer** (`https://id.<platform-domain>`), custom domains for **products only** (`meet.acme.com`); login and `prompt=none` are top-level redirects, so the IdP session cookie still travels; requirements in [03](/architecture/identity-access#custom-domains). Rejected: **one shared project** (any token valid at every API; any tenant user could log into any tenant's meet app); **the cockpit in `Fortspace Admin`** (RustFS cannot read roles, so every operator would get the RustFS console); **RFC 8693 token exchange** (Zitadel only exchanges into audiences the subject token already has, which forces requesting every audience at login); **the IdP on the customer domain** (each custom domain becomes another issuer every product and the API must trust, SSO sessions split per host, a certificate and Zitadel domain configuration per domain, and it is not a tenant boundary; possible enterprise option later). Amends ADR-031 (cockpit project). **Amendment (2026-12-02), the login gate:** Zitadel's login v2 cannot explain a refused login (a user without a role gets the hardcoded "Unknown error occurred", the app never hears of it, upstream #11101), so Zitadel gates only what cannot check roles itself, and our products refuse and explain with their own error pages: `Fortspace Cockpit` has `authorizationRequired` **and** `projectAccessRequired` **off** (the cockpit and `/admin/v1` apply the same rule, `checkPlatformRole`: the resource owner is the platform org and `operator` is granted there; another org gets `wrong_organization`, a missing claim or platform org id refuses everyone); `Fortspace Console` and `Fortspace Workspace` have `authorizationRequired` **off** and `projectAccessRequired` **on** (only granted tenant orgs reach the apps; go-meet checks org and role, `/tenant/v1` org and `tenant_admin`, `/internal/v1` the stack's `sub`); `Fortspace Admin` keeps **both on** (RustFS is role-blind, Zitadel is its only gate). Accepted consequence: any account of the instance can get a Cockpit-audience token, and any user of a tenant org a Console or Workspace token, without a role; every consumer refuses them (audited with tests: API resolvers, cockpit callback and refresh, go-meet callback and refresh). Deploy order, because the cockpit refuses to start without `ZITADEL_PLATFORM_ORG_ID`: the base stack supplies the variable first, then the cockpit image that requires it, then the gate change. Constraint: a new role-blind product gets its own gated project and never joins Workspace or Console (decision D6). Managed in `bastion/src/identity/zitadel-projects.ts` (an in-place update of the adopted projects) and mirrored in the control-plane dev bootstrap. Also corrected: on login v2 a silent login (`prompt=none`) that cannot succeed **never returns to the app** (a login form or a bare JSON error instead of `error=login_required`), so a refused user is explained after an interactive login, never by waiting for a silent one ([03](/architecture/identity-access#moving-between-products)). Rejected: keeping the gate and patching the login UI (a fork of a security component). |
| ADR-033 | **The objects inside Zitadel and Infisical are resources of the base stack**: the four projects and their roles, the `cockpit` and `rustfs-console` apps, the `cp-provisioner` user and key, the MFA login policy; the Infisical projects, folders, platform secrets and the `cp-worker` / `cp-broker` identities. They are declared with the **official Terraform providers** (`zitadel/zitadel`, `infisical/infisical`) through the same *Any Terraform Provider* bridge as Coolify (ADR-020), and the objects that already exist are **adopted by import**, never recreated | **Accepted** (2026-11-30): applied on prod by import (+5 created, ~30 updated, 1 replaced, 54 imported), converged right after (104 resources unchanged), cockpit and RustFS console logins verified; the old `cp-provisioner` key and the old `cp-worker` / `cp-broker` client secrets revoked; the stack config trimmed and the next deploy a verified no-op (a rehearsal on a copy of the prod state). Implemented and tested against dev first, and rehearsed read-only against prod before the apply (the control plane's ids and OIDC clients matched 12 of 12) | `control-plane/tools/prod` used to create all of it through the APIs, from a workstation, with local `.state/*.json` files and a `pulumi config set` round trip into the stack. Now there is one state, a preview and drift detection, and the control plane's project ids, org ids and Infisical credentials flow from the resources into its environment. **Outside the stack:** what authenticates it (the `platform-setup` machine key and an Infisical instance admin token, both secret stack config `base:identityAuth`), the Infisical instance bootstrap, the first Zitadel PAT, the secrets that come from the workstation (`/platform/coolify`, `/platform/registry`, `/platform/pulumi`), human superadmin grants (`superadmin.sh`), and the tenant-level objects, which stay saga steps (ADR-011). **Zitadel returns an OIDC client secret or a key only once, at creation:** an adopted app has none to give, so its client secret stays in stack config; the provisioner key and the Infisical client secrets are created by the stack (one planned rotation, the old ones are revoked by hand after the switch). The Zitadel masterkey, the operator password and Infisical's own keys are **no longer copied into Infisical** (the state is their source, plus the offline escrow): this settles the contradiction between `tools/prod`'s log ("escrow OFFLINE, never in Infisical") and what it did. The providers are configured only after their service's restart action and a readiness check; the deploy checks that the runner reaches both hosts before it previews. Adopted objects are `protect`ed and kept on delete until the rollout is verified. The setup tool gets a **bootstrap-only** setup (`platform-setup.sh`; the former full setup was removed once the stack owned the objects) that does only the outside part and writes `base:identityAuth` through stdin; with it a fresh install needs no cockpit config (the stack uses the secret of the app it created and a generated session password; on the running platform the config still wins). Rejected: `@pulumiverse/zitadel` (last release 2025-03, wraps an old provider version; Infisical ships no Pulumi package at all), and dynamic providers over the REST APIs (code to own, no maintained schema) |
| ADR-034 | **A tenant's Zitadel and Infisical objects are Pulumi resources**: `tenant-identity/<slug>` and `tenant-secrets/<slug>.<step>` stacks, run by the saga steps through the Automation API with the Terraform providers of ADR-033 and the worker's own credentials. The invite, discovery probes and secret reads stay API calls | **Accepted** (2026-12-03), verified on dev; not yet run on prod | Same lifecycle model as the base stack and the Coolify stack; no tenant existed that had to be imported. One program per tenant was not chosen: the saga's order, retries and compensation stay, and some values only exist at their step. Consequences: the state holds every tenant secret encrypted (extends ADR-021); drift detection of these stacks is not wired to the reconciler yet; the tenant login policy is declared in full instead of copied from the instance policy; the worker always needs the Pulumi backend and passphrase |
| ADR-035 | **Tenant products live under the platform domain: `<product>.<slug>.fortspace.eu`**, beside the platform hosts; a separate domain for tenants is rejected, own domains stay an upsell. The shared registrable domain is handled by: host-label rules and a wider reserved list for new slugs; host-only `__Host-` session cookies (go-meet's double-submit `csrftoken` excepted) and origin checks (not `SameSite`) on every state-changing endpoint we own; a new session id at every go-meet login; sandboxed user content on `s3.`; no framing; the Zitadel residual accepted. Details: [13](/architecture/tenant-hosts) | **Accepted** (product, 2026-12-03; answers Q-21); implemented in draft PRs and proven on dev (e2e step 7, Chrome over https); not merged, not on prod. The Public Suffix List is evaluated and **not** submitted; certificates: a Traefik DNS-01 resolver with Scaleway, one certificate per tenant (decided, not applied yet). Code: [control-plane#14](https://github.com/FortSpace/control-plane/pull/14), [go-meet#7](https://github.com/FortSpace/go-meet/pull/7), [bastion#12](https://github.com/FortSpace/bastion/pull/12) | One site for all tenants: a neighbour can toss cookies (`Domain=fortspace.eu`) and send same-site requests with Lax cookies. Found and fixed on the way: go-meet adopted any session id and kept it across the login (account takeover by fixation); Infisical's cookies were not `Secure`; the RustFS console and Mailpit could be framed; the cockpit's CSRF check was an implicit framework default. Residual: Zitadel's login cookies cannot be `__Host-` (signed, so no forgery, but login CSRF with an attacker's own session and shadowing remain); tenant names are public in certificate transparency |

## Corrections to the discussions

These points were stated in the exploratory chats and are **not** carried over
because they conflict with vendor documentation or with later decisions.

| Claim in discussion | Reality / resolution |
|---|---|
| LiveKit tokens support `RoomPrefix` (so one tenant admin token can cover `tenant-*`) | No: `room` is an exact match. → broker with exact-room tokens (ADR-006) |
| Per-key webhook routing/limits in `livekit.yaml` give tenant isolation | Official docs do not establish per-key authZ or per-key webhook routing; multiple keys only distinguish signers. → CP owns tenant authZ |
| Egress `CustomBaseUrl` delivers egress events to the tenant | Not verified in current docs. → router for all events (ADR-007) |
| LiveKit tokens can be refreshed/revoked server-side | Self-hosted removal/permission changes do not revoke issued tokens. → short TTLs |
| Infisical can serve as RustFS's KMS for SSE | RustFS documents local, Vault KV2 and Vault Transit KMS backends. → Q-07 |
| Keycloak orgs/claims; Go control plane; Infisical per tenant | Superseded by Zitadel, TypeScript control plane, shared Infisical |
| Infisical "folder + machine identity per tenant" gives path-scoped read access | Not on self-hosted free tier (v0.167.13): no custom roles or additional privileges ("plan RBAC restriction"). → project per trust scope with built-in roles (ADR-004, Q-15) |
| Coolify API at `/api/v4/...` | Coolify's REST API is `/api/v1` |
| Pulumi state "in PostgreSQL" vs "S3 bucket" (both said) | Postgres DIY backend is documented; use it (no dependency on RustFS for control state) |
| Zitadel org claim `urn:zitadel:iam:org:id` as "the tenant id" | Home-org is `…user:resourceowner:id`; `org:id:{id}` is a *scope* enforcing membership; role grants are separate claims |
| Rocket.Chat and Tuwunel both planned | Reconcile via ADR-002 |
| "Coolify has no maintained Pulumi/Terraform provider" | There is no official Pulumi provider, but a maintained **Terraform** provider exists: **`coolify-terraform/coolify`** (0.1.33, 65 resources), consumed through Pulumi's Any Terraform Provider (ADR-020). The `SierraJC/terraform-provider-coolify` named earlier is stale since 2025-08 and is **not** used |
| Zitadel "require project grant/role" as one instance setting | It is per project: `authorizationRequired` (a role is needed) and `projectAccessRequired` (the user's org must own or be granted the project); since the ADR-032 amendment only `Fortspace Admin` has both on |
| TanStack Start `useSession` for console sessions | No longer exported by `@tanstack/react-start/server`; the official guide uses iron-session over `getCookie`/`setCookie` |
| Sending a pg-boss job in the caller's transaction needs a custom adapter | pg-boss 12 ships `fromDrizzle(tx, sql)` for the `db` option |
| Zitadel management is a single REST API | v4 mixes REST (`/v2/organizations`, `/v2/users`) and Connect-RPC JSON (`/zitadel.<svc>.v2.<Service>/<Method>`, header `Connect-Protocol-Version: 1`) for projects, applications and authorizations |
| RustFS admin via an `mc admin`-style library | No Node library found; admin endpoints under `/rustfs/admin/v3` are signed with SigV4 (service `s3`, root credentials) by the caller. **Verified** on RustFS 1.0.6, see [08](/architecture/data-storage-secrets#object-storage-rustfs) |
| Zitadel access tokens carry the roles claim, and profile claims, as soon as the project asserts roles | Machine (JWT-profile) tokens carry roles only with scope `urn:zitadel:iam:org:projects:roles`; the generic `…:project:roles` claim is not emitted for them; `name`/`email` are only in userinfo. Read the project-specific claim (`urn:zitadel:iam:org:project:<pid>:roles`). See [03](/architecture/identity-access) |
| A user created through the Zitadel API is in an "initial/invited" state until the invite is used | `POST /v2/users/new` yields `USER_STATE_ACTIVE`; there is no invited state. → ADR-019 |
| Zitadel usernames are per org | Per **instance** (the same name in a second org answers 409). → `<orgId>.<email>`, lookup by email, case-insensitive |
| Listing a project's applications returns them all | Default page size is 100, silently truncated. → exact `nameFilter` plus paging |
| Back-channel logout can be set on any tenant host | Zitadel validates it against its outbound deny list and DNS: private or unresolvable hosts are rejected. → config flag, off in dev ([03](/architecture/identity-access#logout-and-session-lifecycle)) |
| Deleting an Infisical project frees its name | It is a soft delete that keeps the slug reserved. → `?hardDelete=true` at offboarding |
| The S3 region is only a label | The AWS SDK sends a `LocationConstraint` for any region but `us-east-1`; RustFS rejects it unless it matches the server. → dev runs `us-east-1` |
| A LiveKit webhook for an unknown tenant is an error | It is answered `200` and dropped (a non-2xx makes LiveKit retry forever); only a failed forward is a `502` |
| Coolify interpolates `${VAR}` in a service's Traefik labels | It does not: the placeholder reaches Traefik verbatim (router never matches; a plugin middleware builds no handler → 503). Real values in labels |
| The Coolify API can enable SSL on a database | It refuses `enable_ssl` ("This field is not allowed"); the UI owns the switch |
| A Coolify `start` applies a changed compose or variable | It is a no-op on a running service; a restart is needed |
| Deleting the Pulumi `EnvsBulk` removes the variables from Coolify | The variables stay on the service and in the container; delete them through the API |
| A Zitadel login for a user with no grant fails with an error | It fails **without saying why**: `Errors.User.GrantRequired` / `Errors.User.ProjectRequired` have no translation; login v1 swallowed the error into the account list, login v2 (v4.20.6) shows the hardcoded "Unknown error occurred" on the password page and never returns to the app. Hence the ADR-032 amendment: only the role-blind `Fortspace Admin` keeps the gate |
| Infisical's `/organizations/<slug>/projects` accepts the org slug | The segment must be the org **UUID**; a slug is cast to a UUID in SQL and answers 500 |
| A machine identity can invite users to the Infisical org | `POST /api/v1/invite-org/signup` accepts a user session only (403 for identities, v0.167); `superadmin` leaves Infisical to the UI |
| A Zitadel ID token's `aud` holds only the client id | It also holds the **project id**; a tool that trusts only the client id rejects the token ("is not a trusted audience"). The project id has to be listed (RustFS: `RUSTFS_IDENTITY_OPENID_OTHER_AUDIENCES`) |

## Open questions

| ID | Question | Needed by | Owner/next step |
|---|---|---|---|
| Q-01 | Platform domain, regions, hosting provider(s) for public VPS + private host | before staging | product |
| Q-02 | Pricing tiers ↔ isolation tiers (Standard / Dedicated data / Enterprise) | before provisioning code | product (the prototype accepts only `standard` and region `eu`) |
| Q-03 | Is a pulumiverse/community Zitadel provider good enough, or write a dynamic provider over the management API? | when Zitadel moves into the Pulumi program (a later phase of ADR-011) | **Answered for the platform objects (ADR-033, 2026-11-29)**: neither. The official Terraform provider through the bridge (`zitadel/zitadel`; the pulumiverse package is unmaintained), proven by import against dev and a read-only rehearsal against prod. Tenant-level objects use the same providers since ADR-034 |
| Q-04 | Zitadel role/group → go-meet `team_ids` mapping format (project roles vs organization metadata) | go-meet Zitadel adapter | go-meet |
| Q-05 | Tuwunel OIDC: native vs delegated; supported appservice features and admin API surface; backup method | before chat work | spike |
| Q-06 | Guest in-call chat: bridge (data channel → Matrix) or no chat | with Matrix work | product |
| Q-07 | Per-tenant SSE keys: OpenBao/Vault Transit KMS for RustFS, or SSE-S3 only | before recordings in prod | security |
| Q-08 | Files/storage product: build on RustFS directly or integrate an open-source drive? Euro-Office storage backend? | roadmap | product |
| Q-09 | Mail: Stalwart per tenant or shared multi-domain? Public SMTP ports/IP reputation under frp | roadmap | engineering |
| Q-10 | Billing/metering source of truth (Zitadel, CP, usage events) | later | product |
| Q-11 | Revisit Temporal if sagas outgrow pg-boss (ADR-015: long waits, human approvals, complex fan-out) | after first saga | engineering |
| Q-12 | Pulumi CLI availability/packaging inside the worker image and state-locking behavior with Postgres backend under concurrency | **Answered** (2026-11-20) | **Answered by the P1 spike** (control-plane `docs/notes/pulumi.md`): Pulumi CLI **3.277.0** (checksummed tarball), `@pulumi/pulumi` 3.277.0, `terraform-provider` bridge plugin **1.5.1**, `coolify-terraform/coolify` **0.1.33**; ~280 MB pre-installed in the worker image, nothing downloaded at runtime. State locking: a second concurrent `up` on one stack is **refused** ("the stack is currently locked by 1 lock(s)"), mapped to `conflict`; a lock left by a killed process is cleared with `stack.cancel()`, and only by the job holding the tenant's pg-boss singleton, never by the API. |
| Q-13 | Broker SLO/replica policy and whether to give Enterprise tenants a dedicated LiveKit key + node | broker design | engineering |
| Q-14 | Rocket.Chat retained for any customer segment? | ADR-002 | product |
| Q-15 | Infisical Enterprise (path-scoped roles) vs project-per-scope for production: license cost vs number of projects | before production | engineering/product |
| Q-16 | Where does the base stack's Pulumi state live? Today a file on one workstation (`bastion/.state`) | before a second operator or any outage drill | **Answered** (2026-11-25) by **ADR-029**: an object storage bucket in the EU (Scaleway `nl-ams`), versioned, bucket-scoped keys, encryption unchanged. See [12](/architecture/bastion-runbook#41-where-the-state-lives). |
| Q-17 | Report upstream: Zitadel's missing `Errors.User.GrantRequired` string (v4.16.0 to main) and login v2 swallowing the error; Infisical `/organizations/<slug>/projects` 500 | when convenient | engineering. Zitadel issues already open, to comment on (drafts first, the user decides to post): [#11101](https://github.com/zitadel/zitadel/issues/11101) (no roles: unclear message), [#11841](https://github.com/zitadel/zitadel/issues/11841) (missing error translations), [#12821](https://github.com/zitadel/zitadel/issues/12821) (login v2: "Unknown error occurred" for a vanished auth request) |
| Q-18 | Verify the prod media path (UDP 7886 → 7884) with a real call, and back up the core Postgres | before the first tenant | engineering (needs go-meet through the broker) |
| Q-19 | Custom domains for tenants: which hosts may a tenant bring, and how does that reach the IdP? | before the first customer asks | **Decided in principle** (2026-11-27, recorded in **ADR-032**): **one issuer** (`https://id.<platform-domain>`), custom domains for **products only** (e.g. `meet.acme.com`). A custom IdP host (`id.acme.com`) is not offered (possible enterprise option later). Details in [03](/architecture/identity-access#custom-domains). |
| Q-20 | Tenant login (W6, [03](/architecture/identity-access#login-policy)): (a) our login texts on tenant login pages; (b) MFA for tenant users | before the first customer | **Answered** (2026-12-03). (a) **Wait for the upstream fix**; `cp-provisioner` does **not** get `iam.policy.write` (an instance permission: it could rewrite the instance login policy), and the saga sets no texts. The bug: Zitadel v4.20.6 `GetHostedLoginTranslation` for an org selects rows by the org's own id (`internal/query/hosted_login_translation.go`), so the instance row its merge code expects is never read: an org page shows Zitadel's built-in texts plus the org's own, never the instance's. To report with Q-17 (W11). (b) **MFA forced for every tenant user**, in the saga's org policy and in the instance default (`forceMfa` on, `forceMfaLocalOnly` off, no setup skip) |
| Q-21 | Tenant public domain scheme: where do a tenant's products live, with which certificates and DNS records? | before the first tenant goes public | **Answered** (product, 2026-12-03): **ADR-035**, everything under `fortspace.eu` (`<product>.<slug>.fortspace.eu`), a separate tenant domain rejected; the same-site threats are handled and proven on dev ([13](/architecture/tenant-hosts)). Certificates decided: DNS-01 with Scaleway, one per tenant. Still to decide there: the Scaleway key's scope and the wildcard check before the resolver goes in, the PSL (not now), the Zitadel residual |
| Q-22 | The tenant frontend (the web app tenants use for calls): our own build, not the stock La Suite image (decision D3) | after the chat↔calls integration is designed | **Deferred** (product, 2026-12-02): it waits for the chat integration, because calls will be a standalone product and/or embedded in chat (jump to a call from a chat, chat rooms created for calls), which shapes the frontend ([07](/architecture/chat-integration)). Nothing is built until then |

## Suggested sequence

1. **Spikes** (1–2 weeks): Pulumi Automation + the Coolify Terraform provider
   against Coolify (**done**: ADR-020, ADR-021, ADR-022); Zitadel
   org/grant/service-account via API; broker + one go-meet joining through it;
   Tuwunel OIDC.
2. **Walking skeleton**: provision one tenant end to end (Zitadel org → DB →
   bucket → Coolify stack → login → call → recording).
3. **Harden**: reconciler, suspension/offboarding, observability, backups with
   a restore drill.
4. **Chat integration**, then SSO self-service, then modules (mail, files).

## Mapping to the repository

| Concern | Today | Change |
|---|---|---|
| Docs | `AGENTS.md`, `go-meet/*.md` | This folder is the architecture reference; `AGENTS.md` points here |
| Deployment drafts | `deployment/` | See table in [09](/architecture/infrastructure) |
| Prototype | `go-meet/` | See table in [06](/architecture/calls-livekit) |
| New code | — | `control-plane/` (pnpm TS monorepo: `apps/{api,worker,cockpit}`, `packages/{config,observability,db,ports,core,schemas,adapters}`, `tools/dev`); prototype plan in that repo's OpenChamber project plan |
