Deutsch
Security wikiArchitecture

What is multi-tenancy?

Also known as: multi-tenant, tenant, workspaces, SaaS multi-tenancy

Multi-tenancy means one app and database serve many customers at once. The common models, why AI-built SaaS apps use shared tables, and what keeps tenants apart.

By Tim GeithnerPublished 2 min read

Short answer

Multi-tenancy is an architecture in which one application, and usually one database, serves many separate customers, called tenants: users, teams, workspaces or companies. Most AI-built SaaS apps keep all tenants in shared tables with a tenant column such as workspace_id. That is cheap and simple, but then every query and every policy must keep one tenant’s rows away from the others.

Ask an AI about this page:ChatGPTClaude

On this page

Multi-tenancy is a software architecture in which one application, and often one database, serves many separate customers, called tenants. A tenant can be a single user, a team, a workspace or a whole company. The OWASP cheat sheet on the topic describes such apps as serving many tenants “from a shared infrastructure”, and its central rule is that one tenant must never reach another tenant’s data.

Multi-tenancy in an AI-built app

Ask Lovable or Bolt for “a SaaS where teams manage projects” and you get a multi-tenant app: a workspaces table, a workspace_members table that links users to workspaces, and a workspace_id column on projects, tasks, invoices and everything else. All customers live in the same tables. Which rows belong to whom is decided only by that column and by the checks around it.

OWASP lists four ways to separate tenants:

ModelBoundaryTrade-off
Separate databasesStrongest: own credentials, backups and network pathsHighest cost to run and migrate
Separate schemasNamespaces and database rolesGrants and search_path need care
Shared tables with row level securityA policy filters rows by tenantCheap and simple; every table and policy must be right
HybridMix by workload or planMore moving parts

Supabase apps almost always use shared tables with row level security. That works, but it moves the whole burden of tenant isolation into your policies and server code.

How to check your app

  1. List every table that holds customer data and confirm it has a tenant column (user_id, workspace_id or org_id) or a clear parent it inherits one from.
  2. For each of those tables, check that RLS is on and that its policies tie the tenant column to the caller, through auth.uid() or a membership lookup, never using (true) or “any signed-in user”.
  3. Check where the current workspace comes from in edge functions and server code. It must be checked against membership on the server, not taken from the request as fact.
  4. Look at the paths that are easy to forget: storage buckets, Realtime channels, background jobs and webhooks.
  5. Test as two users in two different workspaces.

How to prevent problems

Decide the model on day one, give every customer table a tenant column, and write one membership-based policy pattern that every table reuses. The full approach, from schema to tests, is in Multi-tenant data isolation, and roles inside a workspace are covered in Roles and permissions in Supabase.

Frequently asked questions

Is my app multi-tenant if every user only has their own data?

Yes, in the simplest form: each user is a tenant. It becomes harder once users share data in teams or workspaces, because ownership turns into membership.

Should each customer get their own Supabase project or database?

Separate databases give the strongest boundary but cost more to run and change. For most early SaaS apps, shared tables with row level security are a reasonable choice, as long as every table and policy is checked.

Where should the current workspace come from?

From data you verified on the server, such as the user’s membership rows. A workspace ID sent by the browser is only a selection; the database must still check that the user belongs to it.

Sources

  1. 1.Multi-Tenant Security Cheat Sheet — OWASP Cheat Sheet Series
  2. 2.Row Level Security — Supabase Docs
  3. 3.Row Security Policies — PostgreSQL Documentation

Find this in your own app

ShipRely reads your repository (read-only), proves each finding with file and line, and gives you a fix prompt to paste into your AI builder.

Run a demo audit
  • Read-only access to your repository
  • Every finding with file and line
  • Fix prompts for Lovable, Cursor, Claude Code and Bolt