Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

003 Tenants as session boundaries; places by tenant or by user

Summary: why a tenant is a boundary for sessions and not a role system, and why the data’s place is chosen by tenant or by user, never both.
Key terms: tenant, membership, place, directory, PlaceBy.
Related: Scaling · spec 14 · spec 15

Date: 2026-11-25. State: in force, built.

Decided

  • A tenant is a boundary for sessions. A session belongs to one tenant. Entering another tenant makes another session, and may need a new passkey use if its rules are stricter. An unknown tenant and a forbidden one give the same refusal.
  • Memberships without roles. The library keeps tenant, user and state. The application adds its own columns, such as a role, and decides what they mean. Ending a membership ends that user’s sessions, tokens, devices, grants and API keys in that tenant, in the same commit.
  • Memberships live with the users, in every step, so a removal ends access in one commit.
  • A place is chosen by tenant or by user. An application chooses one when it is set up. “Both” would give three answers to one question.
  • Tenant address: a path or a host; both supported, with recipes.
  • No gateway. Every process reaches the users’ database and checks the request itself.

Why

Roles differ in every application, and a library that stores them must also judge them. A session boundary is generic, and it is needed for security: a token of one tenant must open nothing in another.