02 — Tenancy and isolation

Model
Tenant (company)
├─ Zitadel organization (identity boundary, logical)
├─ Coolify project tenant-<slug> (runtime boundary, process/network)
├─ Database meet_<slug> on shard N (data boundary, hard DB)
├─ Bucket tenant-<slug> (object boundary, scoped key + SSE)
├─ Infisical path /tenants/<slug> (secret boundary, machine identity)
└─ LiveKit room namespace <slug>__* (media boundary, enforced by broker)
Teams → Zitadel project roles / groups → claims → go-meet `team_ids`
Users → belong to exactly one Zitadel org (the tenant); guests have no account
Teams are inside a tenant and are authorization data (roles/claims), never an isolation boundary.
Shared vs per-tenant matrix
| Component | Scope | Boundary | Why |
|---|---|---|---|
| Zitadel | shared | Organization + project grant | Auth is token-based; orgs isolate users, IdPs, branding, policies |
| Control plane + admin console | shared | tenant_id in every row; verified caller identity | Owns lifecycle; must see all tenants |
| Infisical | shared (D2) | Path /tenants/<slug> + per-tenant machine identity | A per-tenant Infisical is too heavy |
| LiveKit SFU/Egress + its Redis | shared | Exact-room tokens minted by broker, <slug>__ room prefix | Stateless media router |
| RustFS engine | shared | Bucket per tenant, scoped access key, SSE | Central disk pools |
| Core Postgres | shared | DB/role per product | Low-volume platform data |
| Postgres shards | shared engine, DB per tenant | Database + role | Cost vs hard boundary; drop-database erase |
| go-meet | per tenant | Container + env + network | Memory/log/bug isolation, ~20 MB RSS |
| Redis (go-meet) | per tenant | Container + volume | No shared-key bugs, trivially erased |
| Tuwunel (Matrix) | per tenant | Container + RocksDB volume, federation off | Avoid logical multi-tenant chat bugs |
| Future modules | per tenant | Same pattern | — |
Isolation tiers
| Tier | Who | Differences |
|---|---|---|
| Standard (default SMB) | Most tenants | Matrix above; shared Zitadel instance; shared LiveKit; shared Postgres shard |
| Dedicated data | Larger SMB | Tenant gets a dedicated Postgres node (shard with max_tenants=1) |
| Enterprise | Customers needing CMEK, network isolation, own audit scope | Dedicated Zitadel instance (virtual instance or deployment), dedicated LiveKit key + node pool, dedicated bucket KMS key |
The control plane models the tier as data on the tenant row so the provisioning program can branch without code forks.
Naming conventions
| Resource | Pattern | Example |
|---|---|---|
| Slug | [a-z][a-z0-9-]{1,30} — immutable | acme |
| Hostnames | <module>.<slug>.<platform-domain> | meet.acme.…, chat.acme.… |
| Coolify project | tenant-<slug> | tenant-acme |
| Postgres DB / role | meet_<slug> / meet_<slug>_app | meet_acme |
| Bucket | tenant-<slug> (prefixes recordings/, transcripts/, files/) | tenant-acme |
| Infisical path | /tenants/<slug>/<module> | /tenants/acme/meet |
| Zitadel org | name = slug, id stored in tenants.zitadel_org_id | — |
| LiveKit room | <slug>__<room-uuid> (__ is forbidden in slugs) | acme__3f9c… |
| Pulumi stack | fortspace/tenant/<slug> | — |
Slugs are never reused for 90 days after erasure so room prefixes and presigned URLs cannot collide with a previous tenant.
What the shared plane must never contain
- Chat messages, attachments, meeting titles/participants, transcripts, recordings (bucket contents are in RustFS but encrypted, per-tenant keyed, and unreadable via shared credentials — see 08).
- Any tenant's LiveKit API secret (there is one platform key held by the broker only).
Failure-containment summary
| Failure | Blast radius |
|---|---|
| go-meet bug or OOM | one tenant |
| Runaway SQL | one shard; core Postgres unaffected |
| Redis flush/loss | one tenant's sessions/lobby |
| Compromised tenant stack | its own data + room-scoped tokens (minutes) + its bucket key; not other tenants |
| Compromised control plane | everything — hence minimal surface, separate worker/API roles, Infisical audit, no inbound from tenant stacks except token/event endpoints |
| LiveKit node loss | all live calls, no data loss |