Development

Multi-Tenant SaaS Architecture for Australian Startups: Isolation, Data Residency and What to Decide Before You Build

Jignesh Vagadiya 06/11/2026 27 min read
Illustration of three tenant cards connected to one shared application and database, with the headline One App, Many Tenants

Most SaaS products have the same awkward moment around the third paying customer. Someone asks, “Can I be sure no other customer can see my data?” and the honest answer depends on a decision made months earlier, usually in a hurry, usually by whoever was writing the first migration. That decision is your tenancy model, and it is one of the few early choices that is genuinely painful to reverse.

This guide is for founders, product owners and technical leads in Australia who are about to build a multi-customer software product, or who have built one and suspect the foundations are thin. We will walk through the three isolation models, how to make the cheapest one safe, where Australian privacy obligations change the conversation, and the places where isolation quietly leaks even when the database is fine.

It is deliberately narrower than our broader writing on MVP development, which covers how to scope a first version. Here we assume you already know what you are building and want to be sure the structure underneath will hold when customer number fifty arrives with a security questionnaire.

What multi-tenancy actually means (and what it doesn’t)

A tenant is a customer account that owns its own users, its own data and its own settings, inside software that many other customers also use. Multi-tenancy means those customers share running infrastructure, in some combination of application servers, databases and background workers, while the software keeps their data apart.

The alternative is single-tenant deployment, where every customer gets their own copy of the whole stack. That sounds safer, and in one narrow sense it is. It is also slower to ship, more expensive to run, and miserable to update, because every release has to be rolled out customer by customer. Most early products are multi-tenant for good reasons: one deployment to patch, one place to watch, one bill.

Two things multi-tenancy is not. It is not a feature you add later by tweaking a setting; the shape of your data is different from day one. And it is not the same as having user roles. Roles decide what a person inside an account can do. Tenancy decides which account’s data exists at all, from the point of view of that request. We covered the first half in our piece on role-based access control for client portals and internal tools; this article is about the layer underneath it.

Is your product actually multi-tenant?

A quick test: if two different customers sign in and the software shows each of them a separate “my workspace”, you are multi-tenant. If you are building a tool for one business and its staff, you probably are not, and you can skip most of this. A single-business client portal has users and roles but no tenants.

The grey area is a product that starts as an internal tool and then gets offered to other businesses. That happens more than founders admit, and it is the most expensive way to discover multi-tenancy, because every table in the database assumes there is only one organisation. If there is even a reasonable chance you will sell the thing to a second business, add the tenant column now. It costs almost nothing at the start and a great deal later.

Multi-tenant SaaS architecture: the three isolation models

There are three common ways to keep tenants apart in a database. They sit on a spectrum from cheap and flexible to strict and expensive, and none of them is the right answer for every product.

Shared tables with a tenant ID

Every table carries a tenant identifier column, and every query filters on it. All customers live in the same tables, in one database, in one schema. This is the default for most early-stage products and it is the cheapest to run, the easiest to change and the simplest to report across.

The weakness is that isolation depends on every query being written correctly. One endpoint that forgets the filter, one report that joins two tables and filters only one of them, one admin screen written in a hurry, and a customer sees another customer’s rows. Nothing in the architecture prevents it. The separation lives entirely in application code and in the discipline of whoever is writing it.

That is not an argument against the model. It is an argument for adding a second line of defence inside the database, which we cover below.

Schema per tenant

Each tenant gets its own schema inside one database, a named namespace holding its own copy of every table. Queries run against the tenant’s schema, so a forgotten filter does not leak anything: there is nothing from other customers in the tables being queried.

You gain cleaner separation and a simpler story for customers who ask hard questions. You pay for it in operations. Every schema change has to be applied to every tenant’s schema, and when you have hundreds of tenants a migration that fails halfway leaves some customers on the old structure and some on the new. Teams that choose this model need tooling to run migrations per tenant, track which version each tenant is on, and recover when one fails. Cross-tenant reporting also becomes harder, because the data you want to aggregate is scattered across namespaces.

Database per tenant

The strongest separation: each customer gets a separate database. Backups, restores, encryption keys and resource limits can all be handled per customer. If one tenant needs their data restored to last Tuesday, you restore one database and nobody else notices. If a large customer demands that their data sit in a specific region or under their own keys, you can do it without redesigning anything.

The cost is the most operational overhead of the three. Connection management gets harder, because the application has to route each request to the right database. Small tenants leave expensive capacity sitting idle. Migrations are the same per-tenant problem as the schema model, only with more moving parts. For a founder with a small team and a handful of customers, this model is usually more infrastructure than the product has earned.

The hybrid most products end up with

Most of the architecture write-ups we read while preparing this piece land on the same practical position: pool the small tenants, isolate the large or regulated ones. In practice that looks like a shared database for the long tail of customers on standard plans, with a dedicated database for the enterprise customer whose procurement team has a security checklist as long as their arm.

You do not need to build that on day one. You do need to keep the door open. If your code always asks “which tenant is this?” through one central piece of logic, rather than scattering that decision across hundreds of queries, moving a single tenant to its own database later is a contained project. If it is scattered, it is a rewrite.

Multi-tenant SaaS architecture comparison of shared tables, schema per tenant and database per tenant isolation models, with the main risk of each.
The three isolation models side by side: cost and flexibility on the left, separation and operational overhead on the right.

Here is how we usually frame the choice for a new product:

  • Start with shared tables if you have no regulated customers, a small team, and a product that is still changing shape. Add database-level protection from the start.
  • Choose schema per tenant if you expect a modest number of fairly large customers, each with real data volume, and you have someone who will own the migration tooling.
  • Choose database per tenant if your buyers are in sectors like health, finance or government where separation is a procurement requirement, or if per-customer restore is a feature you will sell.
  • Plan for a hybrid if you can see both kinds of customer on the horizon, even if you only build the shared pool first.

Making shared tables safe with row-level security

If you go with shared tables, and most early products should, the question becomes how to stop a forgotten filter from becoming a data breach. PostgreSQL offers a feature built for this, called row-level security, usually shortened to RLS. You attach a policy to a table saying, in effect, “a query can only see rows where the tenant ID matches the current tenant”, and the database enforces it no matter what the application asks for.

This is defence in depth, not a replacement for filtering in application code. Keep filtering by tenant in your queries, because it reads clearly and helps the query planner. Let RLS be the net underneath, the thing that catches the mistake you did not know you made.

It is also easy to get subtly wrong, and the failure modes are quiet. Here are the ones that matter most.

Set the tenant per transaction, not per connection

The usual pattern is for the application to tell the database who the current tenant is at the start of each request, using a session variable, and for the RLS policy to read that variable. The trap is how that variable is scoped.

Applications almost never open a fresh database connection per request. They use a connection pool, handing connections to requests as needed and taking them back afterwards. If you set the tenant once for the connection and never clear it, the next request to borrow that connection can inherit the previous tenant’s context. Nothing errors. The wrong customer’s rows simply come back, and the bug tends to appear under load, which is exactly when nobody is looking.

The fix is to scope the setting to the transaction, using PostgreSQL’s SET LOCAL, which expires automatically when the transaction ends. Open a transaction, set the tenant for that transaction, run the queries, commit. The context cannot outlive the work it was set for.

If you use a pooling layer in transaction mode, this is not optional. It is the only pattern that behaves predictably.

Five-step flow of a request resolving its tenant, opening a transaction, running a row-level-security query and clearing tenant context.
Setting the tenant inside the transaction means the context cannot outlive the request that needed it.

Roles that skip the policy

RLS has exemptions that surprise people. By default, the owner of a table is not subject to its own policies, and superusers and roles with the bypass attribute ignore them entirely. If your application connects as the table owner, which is common in early projects because it is how the first tables were created, your policies may be doing nothing at all.

The practical rules are short. Have the application connect as a dedicated role that does not own the tables and does not carry the bypass attribute. Use the FORCE ROW LEVEL SECURITY option on tenant tables so even the owner is held to the policy. Keep a separate, tightly controlled role for migrations and administrative work.

Test this directly. Write an automated test that connects as the application role, sets tenant A, and asserts that tenant B’s rows are invisible. A policy you have never seen fail is a policy you are trusting on faith.

What RLS does not cover

Row-level security is a net with holes, and it helps to know where they are.

It works on rows, not columns. If a user is allowed to update their own tenant’s row, the policy says nothing about which columns they change, so a field like plan tier needs separate protection in your application logic or through column-level permissions.

Functions marked to run with their owner’s privileges run outside the policy. A reporting function created by a privileged user and written casually can return counts across every tenant even with RLS switched on.

Foreign key and uniqueness checks are performed by the database internally and are not filtered by the policy, which means constraint errors can in rare cases reveal that a value exists in another tenant. For most products the exposure is small, but it is the reason security reviewers talk about RLS as a layer rather than a guarantee.

Read the PostgreSQL documentation on row security policies before relying on any of this, and treat blog posts, including ours, as a prompt to check rather than a source of truth.

How the application knows who is asking

Isolation in the database is only half of tenancy. The other half is deciding, on every request, which tenant the request belongs to. Get that wrong and the cleverest database policy simply enforces the wrong answer.

The tenant comes from the session, not the URL

It is tempting to read the tenant out of the address: a subdomain like acme.yourproduct.com.au, or a path like /t/acme/invoices. These are great for humans and for branding, but they are input the user controls. If your code trusts the URL to say which tenant’s data to load, anyone who edits it is one guess away from someone else’s account.

The safer pattern is to treat the URL as a hint and the authenticated session as the authority. The user signs in, the session records which tenants that user belongs to, and the server checks that the tenant named in the request is one of them. A mismatch is a hard failure, not a quiet fallback.

Subdomains, paths and custom domains

Each way of routing to a tenant has trade-offs.

  • Subdomains give each customer a recognisable address and make it easy to isolate cookies. They need a wildcard certificate and a little DNS work.
  • Path prefixes are the simplest to build and need no DNS, but they are easier to get wrong because every link in the product has to carry the prefix.
  • Custom domains are what larger customers eventually ask for, so their staff and their clients see the software under their own name. They bring certificate management and domain verification, and you will want to plan for them even if you build them last.

Whichever you choose, put the lookup in one place. One function takes a request and returns the tenant, and everything else calls it.

People who belong to more than one tenant

Real users get messy. An accountant looks after eight small businesses and has eight logins. A consultant is a member of a client’s workspace and their own. A staff member leaves one company and joins another.

If your user table has a single tenant ID column, you have built in the assumption that a person belongs to exactly one organisation, and unpicking that later is unpleasant. A separate membership table, linking users to tenants with a role on each link, costs an extra join and removes a whole class of future pain. The same person can then switch between workspaces without needing a second email address.

Roles and sign-in per tenant

Once tenants are real, they start asking for different things. One wants their staff to sign in through their company identity provider. Another wants a read-only role for their auditor. A third wants to be the only admin and cannot see why you would need access.

Design for roles that live inside a tenant, so one customer’s “admin” has no power over another. And if you expect larger customers, read our guide to single sign-on for Australian businesses before you pick an authentication approach, because bolting enterprise sign-in onto a home-grown login system is harder than choosing a path that supports it from the start.

Australian considerations: privacy, residency and contracts

None of the architecture above is specific to Australia. What changes here is the set of questions your customers will ask and the legal context behind them.

If your software holds personal information about people, the Privacy Act 1988 and the Australian Privacy Principles are in play, for you or for your customers or both. Two of them tend to shape tenancy decisions in practice. Security obligations require reasonable steps to protect personal information, and your isolation model is part of how you demonstrate that. And the cross-border disclosure principle, APP 8, concerns what happens when personal information goes to a recipient overseas.

Hosting in Sydney does not settle the question

A common assumption is that choosing an Australian cloud region settles data residency. It is a good start, and it is often what customers ask about first. It is not the whole answer.

Practitioner commentary on APP 8 points out that data stored in Australia but accessible to administrators overseas can still raise cross-border questions. Support staff at a vendor, a logging service that ships data elsewhere, an email provider, an error tracker, an analytics tool, and an AI model API can each move fragments of customer data outside the country even though your database sits in Sydney.

So the useful exercise is not “which region is the database in”, it is “list every service that touches tenant data and say where each one processes it”. That list is also exactly what a careful customer’s procurement team will ask for. We go deeper on this in our article on AI data residency and sovereignty for Australian businesses, which matters if your product sends tenant content to a language model.

The Office of the Australian Information Commissioner publishes guidance on APP 8, and it is the primary source here, not any agency blog. If your product handles health, financial or government data, take advice from a lawyer who works in privacy before you finalise your hosting and subprocessor arrangements. This article is a technical guide, not legal advice.

Design so residency can vary per tenant

The architectural point is narrower. If some of your future customers will insist on a specific region, or on keys they control, you will want the ability to put one tenant’s data somewhere different from the rest. That is straightforward in a database-per-tenant model and awkward in shared tables.

You do not have to build it now. You do have to avoid decisions that make it impossible, such as hard-coding one database connection string through the codebase, or sending tenant files to a single global storage bucket with no tenant prefix.

Deletion and export are tenancy features

Customers leave, and some of them will ask you to delete their data. In a shared-table model, deleting a tenant means finding every row in every table that belongs to them, plus files, search indexes, caches and backups. If tenant ID is on every table, that is a well-defined job. If it is not, someone will be writing ad hoc queries at midnight and hoping they found everything.

Export is the mirror image. A customer who can take their data with them in a usable format is easier to sell to, and it forces you to know where all their data lives. We wrote about the retention side of this in our guide to data retention automation under APP 11.

Noisy neighbours and per-tenant limits

In a shared system, one tenant’s behaviour can degrade everyone else’s experience. A customer runs an enormous export at 9am, or imports a hundred thousand records, or points a script at your API in a tight loop. Everyone else’s pages slow down and your support inbox fills up.

This is called the noisy neighbour problem, and the answer is limits that apply per tenant rather than globally.

  • Rate limits on the API, keyed by tenant, so one customer’s script cannot consume the allowance for everyone.
  • Queue priorities and per-tenant concurrency caps on background jobs, so a big import waits its turn instead of blocking small ones.
  • Query timeouts and pagination on reports, so a customer with ten years of data cannot lock a table for everyone else.
  • Storage quotas, because file uploads are the quietest way for one tenant to run up your bill.

Build the measurement before you build the limits. Log the tenant ID on every request, job and error from the start. When something slows down, the first question is always “which customer is doing this”, and you want to answer it in a minute rather than a day.

Billing, plans and feature flags per tenant

Tenants are also your billing unit, which means plan and entitlement data belongs on the tenant record from the start. A plan tells you which features are on, how many users are allowed, how much storage is included and whether usage-based charges apply.

Keep entitlements as data, not code. If “Pro customers get the reporting module” is written as an if-statement in twelve places, adding a new plan means a deployment. If the tenant record holds a list of enabled features and the code asks one question, “is this feature on for this tenant”, you can move a customer between plans, grant a trial, or switch a feature off for a misbehaving account from an admin screen.

Most early products connect to a billing provider and let it hold the subscription logic. That is sensible. Keep your own copy of the tenant’s current plan and status, updated through the provider’s webhooks, so your application never has to ask a third party before deciding whether a request is allowed. If you are weighing how subscription billing and the surrounding invoicing should be automated, our guide to subscription billing automation covers that ground.

One small design choice pays off repeatedly: give every tenant a status such as trial, active, suspended or closed, and have the single tenant-resolution function reject requests for tenants that are not active. Suspension becomes one flag instead of a hunt through the code.

Migrations, backups and per-tenant restore

Multi-tenancy changes how you think about schema changes and backups.

With shared tables, a migration runs once and applies to everyone, which is a large part of the appeal. The risk is that it applies to everyone at the same moment. Adding a column is easy. Changing the meaning of a column, or backfilling a large table, can lock things up for every customer simultaneously. Plan large migrations as a sequence of small, reversible steps: add the new structure, write to both, backfill in batches, switch reads, and remove the old structure later.

Backups are where shared tables show their limits. A standard database backup restores the whole database. If one customer asks you to roll their data back to yesterday because a staff member deleted a project, you cannot restore the entire database without overwriting everyone else’s work. Teams solve this in one of three ways: restoring to a side database and copying that tenant’s rows back, keeping an application-level audit log that can reverse changes, or moving customers who need this guarantee onto isolated databases.

None of these is free, which is why we suggest deciding whether per-tenant restore is a feature you will promise before launch, not after the first request. Our article on backup automation and disaster recovery for business systems covers the general discipline, and a tested restore matters more than a configured one.

The places isolation leaks even when the database is fine

Most teams spend their attention on the database and then lose tenant separation somewhere else. These are the usual suspects.

Files and uploads

Uploaded files commonly end up in object storage with a predictable name. If a document’s URL is guessable and does not require a signed, short-lived link, then anyone who knows or guesses it can fetch another tenant’s file regardless of how well the database is locked down. Prefix every object key with the tenant ID, serve files through signed URLs, and check tenant membership before issuing one.

Caches

A cache that stores a rendered page or an API response under a key that does not include the tenant ID will serve one customer’s data to the next person who asks for the same thing. This is one of the oldest multi-tenancy bugs and it still turns up. Every cache key needs the tenant in it, without exception.

Search indexes

If you index tenant data in a search service, either use a separate index per tenant or add a tenant filter that is applied by the server, never by the browser. Search is a favourite place for isolation to fail because it is added late, by someone focused on relevance, with the tenant filter as an afterthought.

Background jobs and scheduled tasks

A job runs outside any web request, so there is no session to carry the tenant. Every job needs to receive the tenant ID as an explicit argument, set the tenant context before touching data, and log it. A job that processes “all overdue invoices” without scoping by tenant is a bug waiting for its first run in production.

Logs, exports and analytics

Logs are full of customer data, and they are usually visible to every developer and support person. Decide what is allowed in them. Exports and analytics have a similar issue: a dashboard that aggregates across tenants for your own use is fine, but make sure it cannot be reached by a tenant user, and that the aggregation does not expose small cell counts that identify a single customer.

AI features and tenant data

If your product includes an AI assistant that answers questions from customer content, tenancy applies to retrieval too. The assistant must only be able to fetch documents belonging to the current tenant, and the retrieval query needs the tenant filter just like any other query. Giving a model broad access to a shared index and asking it nicely to stay within one customer’s data is not isolation. We cover the access-control side of this in our guide to AI agent security for business systems.

What to build in an MVP, and what to defer

Founders sometimes hear all this and conclude they need to build a platform before they have a customer. You do not. A reasonable first version needs a small number of things done properly.

Build these from the start, because they are cheap now and expensive later:

  • A tenant table and a tenant ID on every tenant-owned table.
  • A membership table linking users to tenants with a role.
  • One central place that resolves the current tenant from the session and rejects anything inactive.
  • Row-level security on tenant tables with an application role that cannot bypass it, plus a test proving it.
  • Tenant IDs in your logs and in every cache key, file path and job argument.

Defer these until a customer or a number demands them:

  • Database-per-tenant or schema-per-tenant isolation.
  • Custom domains and per-tenant branding beyond a logo.
  • Per-tenant regions and customer-managed encryption keys.
  • Sophisticated per-tenant rate limiting, beyond sensible global limits.
  • Self-service tenant export and deletion, as long as you can do them by hand safely.

This split follows the principle behind our MVP development work: cut scope, not corners. The list in the first group is not scope, it is structure, and it is the part you cannot easily add once real customer data is flowing.

Common mistakes

These are the patterns we would check first if we were asked to review a multi-tenant product.

  • Adding the tenant column late. Retrofitting a tenant ID onto a populated database, then working out which rows belong to whom, is a project in its own right.
  • Trusting the URL. Reading the tenant from a subdomain or path without confirming the signed-in user belongs to it.
  • Connecting the application as the table owner or a superuser, which silently switches RLS off.
  • Setting tenant context per connection in a pooled environment, so it leaks between requests.
  • Forgetting the non-request code paths: background jobs, scheduled tasks, webhooks and data imports that run without a session.
  • Cache keys, file paths and search filters without a tenant component.
  • One user, one tenant. Building a schema that cannot represent a consultant who works with several clients.
  • Treating entitlements as code instead of data, so every plan change needs a deployment.
  • Assuming an Australian region settles residency, without listing the subprocessors that touch customer data.
  • Never testing the isolation. If no automated test tries to read across a tenant boundary and expects to fail, you do not know that it holds.
  • Promising per-tenant restore or deletion in a contract without having built the means to do it.

Frequently Asked Questions

Is multi-tenant software less secure than giving every customer their own copy?

Not inherently, but it puts more weight on getting the separation right. A single-tenant deployment has a physical boundary between customers, so a coding slip cannot cross it. A multi-tenant system relies on the boundary being enforced in code and in the database. With row-level security, a dedicated application role, tenant context set per transaction and automated cross-tenant tests, a shared system can be defended well. Without those, it is the riskier of the two.

Should a startup start with database per tenant to be safe?

Usually not. It is the strongest model, but it adds connection routing, per-tenant migrations and idle capacity to a team that is still working out what the product is. Shared tables with row-level security is a sensible start for most products, provided you keep tenant resolution in one place so a single large customer can be moved to its own database later.

Does hosting in an Australian cloud region mean we meet Australian privacy requirements?

It helps, and customers often ask for it, but it does not settle the question by itself. Personal information can still be disclosed overseas through vendor support access, logging, email, error tracking, analytics or AI model providers. List every service that touches tenant data and where it processes it, read the OAIC guidance on APP 8, and get advice from a privacy lawyer if you hold sensitive information.

Can we add multi-tenancy to an existing single-business app?

Yes, but it is a real project rather than a configuration change. You add a tenant table and a tenant ID to every owned table, backfill existing data to a first tenant, update every query and background job, and add the membership and role structure. The earlier you do it, the less data you have to migrate and the fewer code paths you have to find.

How do we prove to a customer that their data is isolated?

With evidence rather than assurances. Be ready to explain your isolation model, show the automated test that tries to read across a tenant boundary and fails, list your subprocessors and where they operate, and describe how you handle backups, deletion and access to production data. Larger customers will send a questionnaire, and having these answers written down shortens the process considerably.

When does a tenant deserve their own database?

When separation is a contractual or regulatory requirement, when they need their own region or encryption keys, when their data volume or usage would crowd out other tenants, or when you want to offer per-customer backup and restore as a feature. Until one of those is true, a shared pool is cheaper to run and easier to change.

Where to Start

If you are at the idea stage, start with a short list rather than a design document. Write down who your first ten customers are likely to be, whether any of them will be in regulated sectors, and whether any will want their staff to sign in through their own identity provider. The answers tell you whether shared tables with row-level security is enough or whether you should keep a dedicated-database option in reserve.

If you already have a product running, the quickest useful step is an isolation audit: confirm every tenant-owned table has a tenant ID, check which database role the application uses, write the cross-tenant test, and walk through the files, caches, jobs and search paths listed above. It is usually a short piece of work, and it finds the problems before a customer’s security team does.

If you would like to talk it through, we build web applications and first versions of products for Australian businesses, and we are happy to look at an architecture sketch or an existing codebase and say plainly where we think the risks are. You can see how our fixed-quote approach works on the web app development pricing page.

Worth putting a number on it: because we run lean as a specialist agency rather than carrying a large account-management layer, our fixed quotes typically come in below typical Australian averages for comparable scope. If you’ve already got a written quote from another agency for comparable scope, send it through and we’ll do our best to beat it.

Jignesh Vagadiya

Jignesh Vagadiya is a Digital, Automation and AI Consultant at Growth Digital, an Australian agency building websites, ecommerce stores and custom software for businesses in Melbourne, Sydney, Brisbane, Perth and beyond. He helps businesses grow through digital transformation — strategic system design, development, integration, automation, cyber security and digital marketing. He writes about what actually works in search, paid media and automation, including the parts most agencies leave out.

Got a project you'd like to talk through?

Tell us what you're working on — we'll come back with a plan.