The short answer
Choose multi-tenant, one shared app and database with every row tagged by customer, unless a customer contract or regulation forces separate infrastructure. It is cheaper to run and easier to update. Choose single-tenant when customers demand their own data location, their own release timing or hard isolation, and accept that every customer adds running cost.
On this page
This is one of the few decisions in a SaaS product that is genuinely hard to reverse. Everything else, from the framework to the hosting provider, can be changed with effort. How customers are separated from each other runs through every table, query, test and deploy.
What are the options?
Single-tenant: each customer gets their own copy of the app and its own database. Customers cannot affect each other by accident.
Multi-tenant: all customers share one app and one database. Every row that belongs to a customer carries a tenant id, and the system must never mix them up.
There is a middle path too: one app, but one database (or one schema) per customer. It gives strong separation with shared code, and its cost is operational: many databases to migrate and back up.
How do they compare?
| Single-tenant | Multi-tenant, shared database | |
|---|---|---|
| Running cost per customer | Grows with each customer | Small increment |
| Releasing a fix | Roll out to every copy | Roll out once |
| Isolation | Strong by design | Depends on how well you enforce it |
| Custom code per customer | Easy, and tempting | Hard, which is mostly good |
| Noisy neighbor risk | None | One heavy customer can slow others |
| Backups and restore | Per customer, simple | One restore touches everyone unless planned |
| Data location demands | Easy to meet | Needs a plan |
What questions decide it?
Ask these before you write code:
- Does any customer contract or regulation require separate infrastructure? Some public-sector and financial buyers do. If this is your target market from day one, start single-tenant or per-customer databases.
- How many customers do you expect, and how big is each? A hundred small customers on separate stacks is a hosting bill and an operations load. Ten large ones may be fine.
- Will customers want different versions? Single-tenant invites it. Every custom branch is a debt you pay forever.
- Do customers need their data in a particular region? Then you need either separate deployments per region or a design that supports it from the start.
- How will you onboard? A new tenant should be a database row and an invite email, not a deploy.
For most B2B products sold to small and mid-size companies, the honest answer is multi-tenant.
What makes multi-tenant safe?
The risk in a shared database is one customer seeing another’s data. Application code that remembers to add WHERE tenant_id = ... to every query will eventually forget once. So enforce it where it cannot be forgotten: PostgreSQL row-level security (RLS) makes the database itself refuse to show one tenant’s rows to another.
RLS only protects tables it is switched on for, so the real risk is the table someone adds six months later. We handle that with a test that discovers every table from the database catalog, fails if one that holds tenant data has no enforced policy, and then tries to read and change one tenant’s rows as another. The full method is in proving tenant isolation in CI. Mesito, our CRM for real-estate offices, runs this way.
Also consider:
- the app must connect as a plain database role that cannot bypass RLS;
- shared reference data (countries, currencies) should be read-only for the app;
- file storage needs the same separation, for example a tenant prefix and checks on every download.
What does it cost to change your mind later?
Moving from single-tenant to multi-tenant means merging databases, resolving id clashes and rewriting every query. Moving from multi-tenant to single-tenant means extracting one customer’s rows, which is much easier if every row has a tenant id from the start. That asymmetry is a good reason to design multi-tenant data models even if you deploy single-tenant at first.
What is a sensible default?
Start with one shared database, a tenant id on every customer-owned row, RLS enforced from the first migration, and tests that prove isolation. Keep the option of moving one large customer to its own database later. This covers most products and keeps both costs and risk low.
What should you write down before you start?
Put the decision, the reasons and the conditions that would change it in a short document. Include the isolation rule (“every customer-owned row has a tenant id, and the database enforces it”), how a new tenant is created, how one tenant’s data is exported or deleted, and what a customer can be promised about separation. Deletion and export matter more than teams expect: with a tenant id on every row, removing one customer’s data is a defined job, and you can test that nothing survives it. Without the id, it is detective work across tables.
Working with us
We design and build multi-tenant SaaS platforms, including the isolation tests that show one customer cannot reach another’s data. If you are choosing an approach now, describe your customers and any contract demands and we will tell you which way we would lean and why. Start at contact or read about SaaS platform development.