multi-tenancy
Installation
SKILL.md
Multi-Tenancy
Overview
B2B SaaS is multi-tenant: users belong to organizations, and all data is owned by an org. The cardinal rule is isolation — no request may ever touch another tenant's rows. Use the shared-database, shared-schema model (an org_id column on every tenant table) and enforce scoping in one place: resolve the active org from the session, verify membership, and pass orgId into the data-access layer.
When to use
- The app has teams, workspaces, or organizations.
- A user can belong to more than one org and switch between them.
- You're writing any query against tenant-owned data.