multi-tenant

Implement multi-tenant architecture with JWT org_id isolation for MongoDB and PostgreSQL.

18|2|Updated Dec 12, 2025
One-click install
npx skills add https://github.com/markus41/claude --skill multi-tenant-markus41
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenant
Source: https://github.com/markus41/claude/tree/main/plugins/lobbi-platform-manager/skills/multi-tenant
Command: npx skills add https://github.com/markus41/claude --skill multi-tenant-markus41

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive patterns and code examples for implementing robust multi-tenant architectures, ensuring data isolation, security, and efficient resource management across different organizations within a single application instance.

Core Features & Use Cases

  • Tenant Isolation: Implement strategies for database and data-level isolation using org_id claims in JWTs.
  • Tenant Provisioning: Automate the creation and setup of new tenants, including user management, database initialization, and theme configuration.
  • Cross-Tenant Security: Enforce access controls and audit cross-organizational access attempts.
  • Use Case: When launching a SaaS product, use this Skill to set up distinct environments for each new customer, ensuring their data remains private and secure while leveraging a shared infrastructure.

Quick Start

Activate the multi-tenant skill to set up database isolation for a new organization with ID 'org_new'.

Frequently Asked Questions about multi-tenant

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 using JWT claims?

Isolate tenant data in a multi-tenant SaaS application by extracting the organization ID from JWT claims and applying it to database-level isolation strategies for MongoDB or PostgreSQL. This ensures queries only return records matching the authenticated tenant's organization ID.

What is the best way to automate tenant provisioning for a new SaaS customer?

Automate tenant provisioning by generating workflows that initialize databases, configure user management settings, and apply organization-specific themes. This setup creates a distinct, secure environment for each new customer while leveraging shared infrastructure.

How does cross-tenant security work in shared database environments?

Cross-tenant security in shared environments works by enforcing strict access controls that validate organization ID claims and auditing cross-organizational access attempts. This prevents unauthorized data access between tenants sharing the same application instance.

Can I use this multi-tenant architecture pattern with both MongoDB and PostgreSQL?

Yes, the multi-tenant architecture pattern supports both MongoDB and PostgreSQL for data isolation. It provides targeted database isolation strategies for each system, allowing you to segregate organization-specific data using org_id fields within your existing infrastructure.

When do I need database-level isolation versus row-level security for multi-tenancy?

Database-level isolation separates tenant data into distinct databases or schemas, while row-level security filters data within a shared table using organization IDs. Choose database-level isolation for stricter boundaries and row-level security for simpler scaling in shared infrastructure.

Why should I enforce org_id claims in JWTs for SaaS data segregation?

Enforce org_id claims in JWTs for SaaS data segregation to guarantee that every authenticated request carries the tenant context. This robust data segregation prevents cross-organizational data leaks by binding access tokens to specific organization boundaries.