Skip to main content
Architecture & Engineering

Multi-Tenancy

Multi-tenancy is an architecture where one running application serves many customer organisations, keeping each tenant's data isolated from the others. It is the standard model for SaaS, because operating one shared system costs far less than running a separate deployment per customer.

Isolation is the whole design problem. Shared-database multi-tenancy stores every tenant in the same tables with a tenant identifier on each row, which is efficient but means a single missing filter in a query leaks one customer's data to another. Schema- or database-per-tenant gives stronger isolation at higher operational cost.

Whichever model is chosen, isolation must be enforced structurally rather than by developer discipline — row-level security in the database, or a data-access layer that makes an unscoped query impossible to write. Relying on every developer remembering the tenant filter on every query is not a security model, and the failure is silent until a customer reports seeing someone else's data.

Codazz builds this in production — Multi-Tenant Architecture.

FAQ

Multi-Tenancy
FAQ.

Common questions about multi-tenancy.

Ask Us Anything

Database-per-tenant offers the strongest isolation — a query cannot cross a boundary that does not exist — at the cost of migrations and connection management multiplying by tenant count. Shared-database is far cheaper to operate and is safe when isolation is enforced structurally, through row-level security or a data layer that cannot express an unscoped query.