| 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. |
| 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. |
| 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. |
| 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, 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 and 10. |
| 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). See 02. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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, 10. |
| 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, 12. |
| 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. |
| 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, 10. |
| 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. 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). 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 protected 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 |
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, go-meet#7, bastion#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 |