SaaS multi-tenant architecture
A C4 container diagram of a multi-tenant SaaS product: tenant service and catalog, shared data with row-level security, jobs, metering and billing.
By ArchynoSaaSUpdated November 29, 2026Diagrams: 1Elements: 14Relationships: 12
Licensed under CC BY 4.0: reuse and change it, and credit Archyno
Created with ArchynoUse this template
It opens in the editor as an editable model. No account is needed to change and export it. A free account saves it. Keep the credit to the author.
Open and customizeWhen this architecture fits
Use it for a product that many companies use at once. The main question is how far to separate the tenants. This template shares the application and the tables, and lets the database keep the rows apart. It is the cheapest model to run and the easiest to change. Large customers may ask for their own database later, and the tenant catalog is where that choice is stored.
How a request finds its tenant
Nothing in the product may guess the tenant. It comes from the token, once, and is passed on.
- The identity provider signs the user in, and the token names the tenant.
- The API reads it and sets it on the database connection.
- Row-level security refuses every row of another tenant, even when a query forgets its filter.
- Background jobs carry the tenant too, with one queue per tenant, so one busy customer cannot starve the rest.
Change these parts first
Decide the model per layer instead of once for the whole product.
- Data: shared tables, one schema per tenant, or one database per tenant.
- Region: where a tenant's data lives, and who may move it.
- Limits: what happens at the limit, a warning, a stop or an invoice.
Common mistakes
A cache key without the tenant leaks data between customers. A super user that skips row-level security makes the rule useless, so keep that role out of the request path. And a migration that locks a shared table stops every tenant at once.
What is in this model
- Admin consoleContainer
- Users, roles, plan and invoices of one tenant.
- Application APIContainer
- Reads the tenant from the token and scopes every query.
- Background workerContainer
- Imports, exports and emails, one queue per tenant.
- Billing providerExternal system
- Subscriptions, invoices and cards.
- File storageDatabase
- Files under one prefix per tenant.
- Identity providerExternal system
- Sign-in, SSO and user directory.
- Tenant adminPerson
- Manages users, plan and settings.
- Tenant catalogDatabase
- Which tenant is on which plan, region and database.
- Tenant dataDatabase
- Shared tables. Row-level security splits the tenants.
- Tenant serviceContainer
- Creates tenants, stores plan, region and limits.
- Tenant userPerson
- Works in one tenant's workspace.
- Usage meteringContainer
- Counts use per tenant, for limits and invoices.
- Web appContainer
- The screens of every tenant, on the tenant's own address.
- SaaS productBoundary
- No description.