multi-tenant-saas

Implement multi-tenant SaaS patterns with PostgreSQL RLS and SQLAlchemy.

1|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/aleonsa/claude-config --skill multi-tenant-saas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenant-saas
Source: https://github.com/aleonsa/claude-config/tree/main/claude/skills/multi-tenant-saas
Command: npx skills add https://github.com/aleonsa/claude-config --skill multi-tenant-saas

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexities of building secure and scalable multi-tenant Software-as-a-Service applications, ensuring data isolation and robust access control.

Core Features & Use Cases

  • Tenant Isolation Strategies: Explores different methods like separate databases, schemas, or shared schema with Row-Level Security (RLS).
  • Tenant-Aware Data Models: Provides examples for integrating tenant IDs into SQLAlchemy models and repositories.
  • Row-Level Security (RLS): Demonstrates how to implement RLS in PostgreSQL to enforce data segregation at the database level.
  • Role-Based Access Control (RBAC): Outlines models for roles, permissions, and dependencies to manage user access within tenants.
  • Tenant Context Management: Shows how to extract tenant information from JWTs or subdomains and set it within the application context.
  • Alembic Migrations: Offers patterns for safely adding tenant IDs to existing tables and enabling RLS.

Quick Start

Use the multi-tenant-saas skill to implement row-level security in PostgreSQL for a shared schema architecture.

Frequently Asked Questions about multi-tenant-saas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement row-level security in PostgreSQL for a multi-tenant SaaS application?

Row-level security in PostgreSQL for a multi-tenant SaaS application is implemented by enabling RLS on shared schema tables and setting tenant context via JWT or subdomain extraction to enforce data segregation at the database level.

What are the best multi-tenancy isolation strategies for a scalable SaaS architecture?

Multi-tenancy isolation strategies for scalable SaaS architecture include separate databases, separate schemas, and shared schema with Row-Level Security, with shared schema RLS offering strong data isolation and operational efficiency.

How do I make SQLAlchemy models tenant-aware for SaaS data isolation?

Tenant-aware SQLAlchemy models for SaaS data isolation are created by integrating tenant IDs directly into models and repositories, ensuring queries automatically filter data by the active tenant context.

Does SQLAlchemy work with PostgreSQL Row-Level Security for tenant isolation?

SQLAlchemy works with PostgreSQL Row-Level Security for tenant isolation by binding tenant context extracted from JWTs into database sessions, allowing RLS policies to enforce data segregation transparently.

How do I handle Alembic migrations when adding tenant IDs to existing shared schema tables?

Alembic migrations for adding tenant IDs to existing shared schema tables require safe schema alteration patterns to inject tenant columns and enable Row-Level Security policies without disrupting application availability.

How do I implement Role-Based Access Control within a multi-tenant SaaS application?

Role-Based Access Control within a multi-tenant SaaS application is implemented by defining roles, permissions, and dependencies to manage user access strictly within their specific tenant boundaries.