All templates

SaaS Multi-Tenant Database Schema

Design a SaaS multi-tenant database schema — tenants, plans, users with memberships, workspaces, and audit logs.

Use this template

What you get

  • Tenant as the top-level isolation boundary with tenant_id on every resource
  • Global User with per-tenant Membership and roles
  • Plan / Subscription billing and a tenant-scoped audit log

What this template is for

This SaaS multi-tenant database schema gives you a ready-to-edit ER diagram for any B2B SaaS where each customer (tenant) has isolated data. It models the entities every multi-tenant app needs: the Tenant itself, Plans and Subscriptions that drive billing, Users (a single global identity), Memberships that map users to tenants with a role, Workspaces inside a tenant, and the business Resource rows that all carry a tenant_id for row-level isolation. The key design decision is whether to use shared schema with a tenant_id column (most common) or schema-per-tenant — this template shows the shared-schema pattern. Use it to design a new SaaS, document tenant isolation for a security review, or explain how users join multiple tenants.

When to use this template

  • Design the database for a new B2B SaaS where customers can't see each other's data.
  • Decide between shared schema with tenant_id versus schema-per-tenant isolation.
  • Model how a single user account can belong to multiple tenants with different roles.
  • Plan billing entities: how subscriptions and plans relate to tenants.
  • Document tenant isolation boundaries for a security or compliance review.
  • Show where every business resource carries tenant_id for row-level filtering.

How to use it

  1. 1Start with Tenant at the center — every other table either describes it or scopes to it.
  2. 2Add Plan and Subscription so each tenant has a current plan and billing state.
  3. 3Add User as a global identity and Membership as the tenant-user-role link.
  4. 4Add Workspace inside a tenant (optional, for projects or teams within a tenant).
  5. 5Add the business Resource tables; every one carries tenant_id for isolation.
  6. 6Add an AuditLog scoped by tenant for compliance and debugging.

Quick example

B2B SaaS schema

Plan → Subscription → Tenant
User ↔ Membership ↔ Tenant (one user can belong to many tenants)
Tenant → Workspace → Resource (every row carries tenant_id)
User → AuditLog (action, tenant_id, timestamp)
Row-level security: WHERE tenant_id = current_tenant() on every query

Start editing online

Open the template in CodePic, replace the sample nodes, and turn it into your own study board in a few minutes.

See examples: /templates/saas-multi-tenant-database-schema/examples

More templates you might like