Skip to content

Decision 0001: multi-tenancy is one database per tenant

Status: superseded the same day by the coalition design (docs/design/coalition-structure.md): one install serves a coalition, with alliance and corp pages isolated by an org tree in one database. Kept for the reasoning. Federation by OIDC still applies between separate coalitions.

~~accepted, 2026-12-03 (strategy review item 2.5)~~

Context

Phase 5 plans a coalition / multi-tenant mode. The two ways to get there are a tenant_id on nearly every table, or a separate deployment (and database) per tenant. Adding tenant_id after Phases 1 to 4 would be the most expensive migration the project could face, so the choice has to be made now.

Decision

Each tenant (alliance or coalition member) runs its own Nexus with its own database. Tables get no tenant_id. Coalition features are built by federation between instances:

  • Each instance is an OIDC provider (Phase 2). A coalition service, or another Nexus, signs pilots in through their home instance and reads their corp, alliance, State and groups from the ID token's claims.
  • Shared resources (coalition timers, doctrines, ping relays) live in whichever instance or service owns them, and accept pilots by those claims.
  • Hosting many small tenants is an operations job (one compose project per tenant, or one Postgres server with many databases), not a schema feature.

Consequences

  • No schema change, now or later, for multi-tenancy. Queries never need a tenant filter, so one tenant can't leak into another through a missing WHERE.
  • Each tenant has its own vault key, EVE application and Discord bot: a compromise of one doesn't expose the others.
  • Cross-tenant reporting (for example coalition-wide PAP totals) needs an API between instances rather than a SQL join.
  • Per-instance memory is the cost: measure it in the Phase 3 benchmarks.