ERData modelSimple

SaaS multi-tenant schema

Tenants, users, roles, and resources for a row-level multi-tenant SaaS database.

SaaS multi-tenant schema preview

What this diagram shows

Step 01
Tenant root

Every user and resource is owned by exactly one tenant — the isolation boundary.

Step 02
Role assignments

Users pick up permissions through role assignment rows, not direct fields.

Step 03
Shared schema

All tenants share the same tables, separated by tenant_id columns.

About er diagrams

Entity-relationship diagrams sketch the shape of a data model: tables, their fields, and how they reference each other. They help when planning schemas or explaining a database at a glance.

This template is written in Mermaid — plain text you can edit, version in git, and regenerate the image from any time.

View Mermaid sourcePlain-text diagram syntax — copy or edit directly.
diagram.mmd
1erDiagram
2 TENANT ||--o{ USER : has
3 TENANT ||--o{ RESOURCE : owns
4 USER ||--o{ ROLE_ASSIGNMENT : granted
5 ROLE ||--o{ ROLE_ASSIGNMENT : grants
6
7 TENANT {
8 uuid id
9 text name
10 text plan
11 }
12 USER {
13 uuid id
14 uuid tenant_id
15 text email
16 }
17 ROLE {
18 uuid id
19 text name
20 }
21 ROLE_ASSIGNMENT {
22 uuid user_id
23 uuid role_id
24 }
25 RESOURCE {
26 uuid id
27 uuid tenant_id
28 text kind
29 }