SaaS1 min read

The decision to make on day one of a multi-tenant SaaS

Where you separate customer data shapes the years that follow. Three approaches and the one we chose.

In the first version of a SaaS product there is one customer and tenant isolation looks unnecessary. Adding it later is one of the most expensive changes you can make.

Three basic approaches

A database per customer gives the strongest isolation and costs the most to operate. A schema per customer is the middle way, but migrations get harder as schemas multiply. A tenant column on shared tables is cheapest, yet one missing filter means a data leak.

What we do

In Teknolivra we combined shared tables with PostgreSQL row-level security. Even if application code forgets a filter, the database will not return another tenant’s rows.

Test it

Tenant isolation cannot be trusted without tests. From day one, write tests that create two tenants and confirm one cannot reach the other’s data.

FluxPeek MühendislikEngineering team

Our articles come from issues we meet in our own projects.

Related articles

SaaS

How to set SaaS pricing

Per-seat, usage-based or tiered: ways to choose the right pricing model for your SaaS product.