Multi-tenant architecture for a product you intend to sell
Tenancy is the decision that is cheapest before the first customer and most expensive after the hundredth. It determines how you deploy, how you bill and how much you can promise about data isolation.
Three models
Shared schema with a tenant column is the cheapest to build and operate, and the easiest to report across. Separate schemas per tenant sit in the middle. Separate databases give the strongest isolation and the highest operating cost.
Most products should start shared with strict query scoping, and move large customers to dedicated infrastructure when a contract or data residency requirement demands it.
Scoping has to be structural
A tenant filter applied by hand in each query will eventually be forgotten. Enforce tenancy in one place: a repository layer, a database policy or a session variable that the queries cannot bypass.
Design for the exit
Every plan should support exporting a tenant’s complete data and deleting it on request. That capability also makes enterprise sales conversations shorter.
Common questions
- When should we switch to database-per-tenant?
- When a customer contract requires it, when data residency demands it, or when a single tenant’s volume threatens shared performance. Not before.
- Does multi-tenancy affect pricing?
- It changes operating cost rather than build cost. Shared tenancy keeps infrastructure and support cheap, which lets you price lower tiers profitably.
Next step
If this question is live in your business right now, describe the situation and you will get a written view on the options, including whether you should build at all.
Discuss your projectRelated notes
All insightsWhen spreadsheets stop being enough
The signs that a spreadsheet-driven operation needs a real system, and the cheapest first step that is not a full ERP implementation.
ReadCustom softwareHow to justify an internal tool
A simple model for calculating whether an internal tool pays for itself, using hours recovered, error cost and the value of visibility.
ReadCustom softwareIntegrating systems without creating a spider web
How to connect CRM, ERP, payments and internal tools with clear ownership of data, retries and error handling.
Read