Multi-Tenancy Patterns
Use this skill when one deployment serves many tenants.
1. Isolation models
| Model | Idea |
|---|---|
| Silo | Separate infra per tenant |
| Pool | Shared infra; tenant discriminator |
| Bridge | Hybrid (sensitive silo + pooled) |
2. API rules
- Route/resolve tenant from verified token claims — never trust raw client-supplied tenant IDs alone.
- Enforce tenant on every query and cache key.
- Per-tenant rate limits; guard noisy neighbors.
- Cross-tenant access = critical security bug (BOLA class).
3. Quick checklist
- Isolation model chosen deliberately.
- Tenant identity verified cryptographically.
- Data access scoped in all layers.
- Cache/queue keys prefixed by tenant.
- Per-tenant quotas.
See reference.md and examples.md.