multi-tenancy-design

Design multi-tenant SaaS architectures with isolation models and routing strategies.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/marquesfelip/agents-and-skills --skill multi-tenancy-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenancy-design
Source: https://github.com/marquesfelip/agents-and-skills/tree/main/skills/multi-tenancy-design
Command: npx skills add https://github.com/marquesfelip/agents-and-skills --skill multi-tenancy-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Multi-tenant design addresses the need to securely isolate data and operations across tenants in a SaaS product, enabling scalable growth while maintaining compliance and operability.

Core Features & Use Cases

  • Isolation model evaluation and decision guidance for database-per-tenant, schema-per-tenant, and shared-schema approaches
  • Tenant data model design including core tenants, memberships, and tenant-scoped tables
  • Tenant identification and routing strategies (subdomains, path prefixes, or JWT claims) with secure context propagation
  • Data access isolation patterns and repository-level scoping to prevent cross-tenant access
  • Provisioning, migrations, and deprovisioning workflows per tenant

Quick Start

Outline a complete multi-tenant design plan for a 100-tenant SaaS, specifying the chosen isolation model, data model, and routing, plus a provisioning strategy.

Frequently Asked Questions about multi-tenancy-design

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

FAQPage Schema
What is the best way to design multi-tenant data isolation for a SaaS application?

Multi-tenant SaaS isolation requires evaluating database-per-tenant, schema-per-tenant, and shared-schema models. The optimal approach balances strict data separation against operational overhead and migration complexity based on your scalability needs.

How do I route tenant requests using subdomains, path prefixes, or JWT claims?

Tenant routing identifies users via subdomains, path prefixes, or JWT claims, then propagates this data through a secure, typed context. This ensures all subsequent operations carry the correct tenant information for accurate data access scoping.

How do I scope database queries to prevent cross-tenant data access in a shared-schema model?

Preventing cross-tenant access in shared-schema models requires strict tenant_id scoping on all queries. Implement repository-level data access patterns that automatically apply this isolation filter, ensuring no query executes without a valid tenant context.

What should I include in a multi-tenant data model with tenant memberships and routing?

A multi-tenant data model defines core tenants, memberships, and tenant-scoped tables. It specifies provisioning and deprovisioning workflows per tenant, plus routing strategies via subdomains, path prefixes, or JWT claims with secure context propagation.

When should I choose database-per-tenant over a shared-schema multi-tenant approach?

Choose database-per-tenant for stronger isolation and compliance needs, accepting higher operational overhead. Choose shared-schema for cost efficiency and simpler maintenance, requiring strict tenant_id scoping to prevent cross-tenant data access.

How do I handle database schema migrations for each tenant in a SaaS product?

Migrations per tenant require defining provisioning and deprovisioning workflows that apply schema changes individually across all tenant databases or schemas, ensuring every tenant remains synchronized without downtime.