backend-multi-tenancy
Installation
SKILL.md
Backend Multi-Tenancy
Purpose
Implement tenant isolation in a SaaS application using row-level, schema-per-tenant, or DB-per-tenant strategies with automated provisioning and safe migrations. The core challenge is guaranteeing that no tenant can access another tenant's data while balancing operational complexity, cost, and compliance requirements.
Architecture/Decision Trees
Isolation Strategy Decision Tree
Is regulatory compliance required (GDPR/SOC 2/HIPAA)?
|-- YES --> Do tenants require full data separation?
| |-- YES --> DB-per-tenant (highest isolation)
| |-- NO --> Schema-per-tenant
|-- NO --> Expected tenant count?
|-- < 100, B2B --> Schema-per-tenant
|-- >= 100, B2C --> Row-level (shared database)
|-- Mixed (B2B+B2C) --> Hybrid: row-level for B2C, schema for B2B