What problem does it solve?
Building a SaaS application where multiple customers share one database risks cross-tenant data leaks if any query forgets its tenant filter. This Skill guides the design of tenant isolation using PostgreSQL row-level security, tenant-aware middleware, and ORM-level scoping so every query is constrained to the correct tenant.
Core Features & Use Cases
- Tenancy Model Selection: Compares shared-schema, schema-per-tenant, and database-per-tenant approaches based on scale and isolation requirements.
- Defense-in-Depth Isolation: Combines PostgreSQL RLS policies with Express middleware that sets
app.current_tenant_id per request and Prisma middleware that injects tenantId into every query.
- Safe Admin and Operations Patterns: Covers cross-tenant admin routes, tenant provisioning, migrations with RLS, background jobs, and GDPR data exports.
- Use Case: When adding multi-tenancy to an existing single-tenant TypeScript app, use this Skill to add
tenant_id columns, write RLS policies, and build middleware that scopes every request automatically.
Quick Start
Ask the AI to design a multi-tenant PostgreSQL schema with row-level security and tenant-scoped Express middleware for your SaaS application.