The Three Multi-Tenancy Models
There are three principal approaches to multi-tenancy, differing in how much infrastructure is shared and how data isolation is enforced. The shared database, shared schema model puts all tenants in the same database and the same tables, distinguished by a tenant_id column in every row. This is the simplest model: one schema to manage, one set of migrations to run, and straightforward queries once the tenant_id filter is applied consistently. The shared database, separate schema model gives each tenant their own schema within the same database server. Tenant isolation is enforced at the schema level rather than the row level. Migrations need to be applied to each schema individually, which adds operational complexity but makes per-tenant operations (backup, deletion, cloning) much cleaner. The separate database model gives each tenant a completely isolated database. This provides the strongest isolation guarantee and is required by some enterprise customers and some regulatory frameworks. It comes with the highest operational complexity: provisioning new databases on signup, managing connection pools for many databases, and coordinating schema migrations across all customer databases.
Choosing the Right Model for an AI SaaS MVP
For the vast majority of AI SaaS MVPs, shared database with shared schema and row-level isolation is the correct starting point. The operational overhead of separate schemas or databases is significant and not justified until you have customers whose requirements specifically demand stronger isolation. The critical implementation discipline for shared schema multi-tenancy is ensuring that every single database query includes a tenant_id filter and that this filter is applied at a level where it cannot be accidentally omitted. In a Next.js application, this typically means wrapping your database client in a tenant-scoped helper that automatically appends the current tenant's ID to every query. Without this discipline, a bug in a single query can expose one tenant's data to another, which is a serious security and GDPR violation. Code review checklists that verify tenant_id filtering in every new query, combined with integration tests that verify cross-tenant isolation, are essential safeguards.
Multi-Tenancy for Vector Databases in AI Products
AI products using vector databases for semantic search or RAG pipelines face a specific multi-tenancy challenge. Vector databases like Pinecone, Weaviate, and pgvector do not naturally enforce row-level access control in the same way relational databases do. You need to implement tenant isolation explicitly. In Pinecone, namespaces provide logical partitioning: all of one tenant's embeddings go into their namespace, and searches are scoped to that namespace. In Weaviate, tenant isolation can be implemented using the built-in multi-tenancy feature (in recent versions) or through metadata filtering. In pgvector (PostgreSQL extension), row-level security policies can enforce tenant isolation at the database level. Failing to implement vector database multi-tenancy correctly means that a semantic search for one tenant could surface results from another tenant's documents, which is both a security failure and a GDPR violation if those documents contain personal data.
Enterprise Multi-Tenancy Requirements
As a SaaS product moves upmarket toward enterprise customers, multi-tenancy requirements become more demanding. Enterprise procurement teams, particularly in financial services, healthcare, and the public sector, will ask about data isolation as part of their security review. Common enterprise requirements include the ability to place their data in a specific geographic region (data residency for GDPR compliance), a dedicated database or schema that can be backed up and restored independently, the ability to bring their own encryption keys (BYOK) to encrypt their data at rest, and network isolation options such as private endpoints or VPC peering. These requirements do not need to be implemented at MVP stage, but designing your data model with clean tenant boundaries from the start means you can offer database-per-tenant as an enterprise tier without a data migration exercise when the time comes.
Multi-Tenancy and GDPR Article 28
Under UK GDPR and EU GDPR, when you process personal data on behalf of another organisation (your SaaS customer), you are a data processor and they are the data controller. Article 28 requires a Data Processing Agreement (DPA) to be in place between you and each customer for whom you process personal data. In a multi-tenant SaaS product, this means you need a DPA with every business customer. Your DPA must describe what personal data you process, for what purposes, with what security measures, and where it is stored. For UK products, the ICO has published standard contractual clauses that can form the basis of your DPA. For AI SaaS products, the DPA must also cover any LLM API calls that might process the customer's personal data, because those calls represent onward transfers to a sub-processor (OpenAI, Anthropic). You need your LLM provider's DPA in place and must disclose this sub-processing relationship in your own DPA.
Operational Considerations for Multi-Tenant AI SaaS
Running a multi-tenant AI SaaS requires operational disciplines that single-tenant applications do not. Tenant-aware logging is essential: every log line should include the tenant ID so that when investigating an issue, you can filter to the relevant tenant's activity. Tenant-aware monitoring allows you to detect when one tenant is consuming a disproportionate share of resources, either through legitimate high-volume usage or through a bug that is triggering excessive AI calls. Per-tenant rate limiting at the API level prevents runaway usage from impacting other tenants. For AI SaaS specifically, per-tenant LLM token usage tracking is important for cost attribution and for detecting anomalous usage. Tenant-scoped audit logs provide the compliance trail needed to respond to data subject access requests under GDPR and to FCA audit requirements for regulated products. SpeedMVPs builds all of these operational layers into multi-tenant AI SaaS products from day one.