← home ⟳ live · refreshes every 2s

Multi-tenant orion, X-rayed

Two planes, real Durable Objects. One Directory DO is the control plane (directory + sessions + RBAC + the gate); each workspace is its own Workspace DO — DB-per-tenant by construction, so no query can reach another tenant's rows.

tenant-scoped RBAC · policy-as-code

A role expands to (action, resource) grants where resource = the workspace key, so a grant only applies in its tenant. The gate's can(account, action, workspace) matches the viewer's grants — wildcards too.

owner * (all actions)
admin todo:createtodo:toggletodo:deletemember:manage
member todo:createtodo:toggle
trace of THIS request (edge-measured)
GET /console
   Worker
   Directory DO /_console  (control plane: directory + your roles)  36ms
   fan-out to 3 Workspace DOs /_count  (cross-tenant = N round-trips)  746ms
served from colo CMH

# a DATA request, e.g. GET /w/acme/todos:
   Worker  Directory DO /_gate/acme  verdict{member, role}  Workspace DO
  non-member → 403 at the gate, before any Workspace DO is contacted
control plane · 1 Directory DO
Runs example-tenant's createTenancy(store) slices, unchanged — the apex home, the cookie session, the transition verbs, tenant-scoped RBAC, and the /_gate the data plane is checked against.
data plane · 3 Workspace DOs (one per tenant)
view as alice bob carol

acting as alice · Workalice has 2 personas; switch and the workspaces below change (same human, different identities — the GitHub/Slack shape).

your workspaces

Acme Inc owner
0 todos · DO 4e4259be…6df6
aliceowner carolmember
Globex member
1 todo · DO 6bbe2705…adc8
bobowner alicemember carolmember

other tenants — probe one to watch the gate refuse you

Alice's Home not a member
0 todos · DO cbed7577…78bb
aliceowner
live store calls · the SQL actually running

Recorded per DO via instrumentStore, newest first, refreshing every 2s — the console's own polling reads are excluded. Open a workspace or add/check a todo and watch the queries land (the gate's membership lookup, the todos CRUD).

directory one 1 row · 1 param
select id, name 
from workspaces 
where id = ?