What is multi-tenant SaaS architecture?

Multi-tenant means one running application serves many customers (tenants), each seeing only its own data. The simplest version keeps everyone in one database with a tenant identifier on every record; stricter ones separate data per customer at a higher cost.

A tenant is a customer organisation, with its own users and data. In a multi-tenant system they share the same code and servers, which keeps costs and effort low, but you must be certain one tenant can never see another’s data.

Three common patterns

PatternHowGood forCost
Shared database, shared tablesEvery row carries a tenant id; every query filters by itMany small customers, fast startCheapest; a missed filter leaks data
Separate schema per tenantOne database, own set of tables for each tenantStronger separation, per-tenant changesMore to migrate and manage
Separate database per tenantEach customer has its own databaseLarge customers, strict isolation, special requirementsHighest operations cost

How to avoid leaking data

  • Apply the tenant filter in one central place, not in every query by hand.
  • Test explicitly that tenant A cannot reach tenant B’s records.
  • Consider database features that enforce row-level separation.
  • Include the tenant in logs and backups so you can reason about what belongs to whom.

Choosing for a start

For most new products the shared-table approach with strict, tested filtering is enough, and it can be moved to stronger isolation for particular customers later if they require it. Choosing a heavier design on day one usually buys complexity you do not yet need.

All questions