Engineering guide · General design considerations, not a client case study or a claim of certified compliance.
Choose isolation according to risk
Shared tables can simplify operations and reduce overhead, but every access path must enforce tenant scope. Separate schemas provide a naming boundary while sharing the database’s resources. Separate databases offer stronger operational separation at the cost of more migrations, backups and connection management. The right choice depends on contractual isolation requirements, data volumes, recovery needs and the team’s ability to operate the chosen model.
Derive tenant scope from a trusted session
A tenant identifier supplied in a request is a lookup value, not proof of access. Resolve the caller’s membership and permissions on the server before selecting a tenant. In a shared-table model, row-level policies can provide an additional boundary, but privileged service credentials may bypass them. Background jobs, exports and administration tools must apply their own explicit scope checks. Never assume that protecting the main dashboard protects every data path.
Follow data beyond the database
Tenant isolation also covers cache keys, object-storage paths, search indexes and queued messages. Include tenant scope in cache keys and check access before issuing download links. Ensure that retries preserve the original tenant context. Test with two tenants that have similarly named records so accidental cross-tenant lookups are observable. Include reporting, full-text search and support workflows in those tests, not just standard create and update operations.
Plan migrations and recovery
A fleet of databases needs version tracking, staged migrations and failure recovery. A shared database needs a tested strategy for tenant-level export or restore; restoring the entire database may affect unrelated customers. Enforce resource limits to reduce noisy-neighbour effects and monitor consumption by tenant. Document how a tenant is provisioned, suspended and deleted, including retained backups and contractual retention rules. These lifecycle operations are part of the isolation design.
Related engineering services
More engineering guides
- Designing LLM systems that survive production
- An opinionated Azure landing zone for regulated workloads
- Zero-trust architecture for enterprise apps
- Platform engineering: from cost center to product
- The pragmatic legacy modernisation playbook
- The custom software development process, step by step
- How to Choose the Right CRM Software for a Growing Business
- Lead Management Software: The Complete Guide to Capturing, Tracking, and Converting Leads
Project requirements, acceptance criteria and operating responsibilities should be agreed before implementation.
Discuss your engineering requirements