multi-tenancy

Implement tenant isolation middleware and schema-per-tenant strategies for FastAPI and TypeScript apps.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/franciscosanchezn/easyfactu-es --skill multi-tenancy-franciscosanchezn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenancy
Source: https://github.com/franciscosanchezn/easyfactu-es/tree/main/.github/skills/multi-tenancy
Command: npx skills add https://github.com/franciscosanchezn/easyfactu-es --skill multi-tenancy-franciscosanchezn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Multi-tenant SaaS architectures often struggle with reliable tenant isolation, scalable routing, and secure access controls across subdomains and headers. This Skill provides patterns, middleware, and database isolation strategies to address those challenges in Python and TypeScript environments.

Core Features & Use Cases

  • Subdomain-based tenant routing for automatic tenant resolution.
  • Header-based tenant identification and optional JWT-based tenant propagation.
  • Schema-per-tenant isolation and optional Row-Level Security policies for data security.
  • Tenant context management, onboarding, and per-tenant migrations.
  • Cross-tenant security testing and isolation validation.

Quick Start

Configure your application to resolve tenants from subdomains or X-Tenant-ID headers, then create per-tenant schemas and enforce isolation via schema-based or RLS-based strategies.

Frequently Asked Questions about multi-tenancy

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

FAQPage Schema
How do I isolate tenant data in a multi-tenant SaaS application?

Isolate tenant data in a multi-tenant SaaS application using schema-per-tenant database structures or Row-Level Security policies. This Skill provides tenant resolution middleware and dynamic schema creation to enforce strict data boundaries.

What is the best way to resolve tenants from subdomains in FastAPI?

Resolve tenants from subdomains in FastAPI using tenant resolution middleware. This Skill provides patterns for automatic subdomain-based routing and optional header-based tenant identification via X-Tenant-ID.

How do I implement Row-Level Security for multi-tenant isolation?

Implement Row-Level Security for multi-tenant isolation by applying database policies that restrict data access based on tenant context. This Skill provides guidance and testing patterns to validate RLS-based isolation strategies.

Does this multi-tenancy pattern support TypeScript frontends and Python backends?

This multi-tenancy pattern supports Python backends using FastAPI and TypeScript frontends. It provides cross-stack tenant context management, header-based tenant propagation, and subdomain routing for both environments.

How do I handle per-tenant database migrations in a SaaS architecture?

Handle per-tenant database migrations in a SaaS architecture by dynamically creating schemas and applying migrations during tenant onboarding. This Skill provides tenant context models to manage these isolated database structures.

How do I test cross-tenant security and validate data isolation?

Test cross-tenant security and validate data isolation by executing isolation validation tests against your tenant resolution middleware and database boundaries. This Skill provides specific patterns for cross-tenant security testing.