How we design scalable SaaS architectures
The short answer
Multi-tenant architecture comes down to three early decisions: how tenants are isolated, where module boundaries sit, and how one noisy tenant is prevented from degrading everyone else. Get those right and most later problems are ordinary work. Get isolation wrong and every subsequent decision inherits the mistake.
Start with the isolation decision
Almost every hard question in a multi-tenant product traces back to one early choice: how tenants are separated. Row-level scoping is cheap to operate and hard to get wrong only if every query passes through one data-access layer. Schema-per-tenant gives stronger isolation and simpler per-tenant exports, at the cost of migration complexity that grows linearly with your customer count.
| Approach | Best when | The cost you accept |
|---|---|---|
| Row-level scoping | Many tenants, standard compliance needs | One leaked query exposes everyone; enforcement must be centralised |
| Schema per tenant | Fewer, larger tenants, per-tenant export or residency requirements | Every migration runs N times and must be reversible N times |
| Database per tenant | Regulatory isolation, enterprise contracts demanding it | Operational cost per tenant stops being flat |
We pick based on the compliance story and the realistic tenant count, and then we enforce it in exactly one place in the codebase. Isolation enforced in scattered query builders is isolation that will leak.
Boundaries before microservices
Most early-stage SaaS products do not need microservices; they need boundaries. A modular monolith with strict module contracts gives you most of the design benefit and almost none of the operational cost. When one module genuinely outgrows the deployment, the boundary is already there to extract along.
The failure mode we are avoiding is not monolith or microservice. It is a system with neither boundaries nor separate deployments, where everything can reach everything, and the only way to understand a change is to read all of it.
Plan for the noisy tenant
One tenant will import a million rows or fire a bulk operation during your peak hour. Per-tenant queues, per-tenant rate limits and background processing for anything unbounded keep that from becoming everybody's outage.
- Anything unbounded runs in a background worker, never in a request.
- Queues are partitioned by tenant or priority class, so one backlog does not starve the rest.
- Rate limits are enforced per tenant, held in shared state rather than per process.
- Every list endpoint has a maximum page size the client cannot override.
The decisions that are cheap now and expensive later
- Tenant isolation strategy, because changing it means migrating live customer data.
- Whether tenant identity is on every table from the start, because retrofitting it touches every query.
- Whether billing state is derived from usage events or stored as a snapshot, because reconstructing history you never recorded is impossible.
- Whether permission checks read from one authoritative place, because scattering them means never being sure they are complete.
None of these take long to decide at the beginning. All of them are multi-week projects to change once real customers exist, which is the entire argument for spending a week on architecture before spending three months on features.
