Member-only story
Building Multitenant App using Azure Cosmos DB in Clean Architecture
Discuss how to build a multitenant web API application with partition per tenant data isolation using Azure Cosmos DB in Clean Architecture.
Background
When building multi-tenant applications using Azure Cosmos DB (or other NoSQL databases), there are multiple popular data isolation models:
- Partition key per tenant
- Container per tenant
- Database per tenant
Microsoft has a detailed documentation, Multitenancy and Azure Cosmos DB, covering how Azure Cosmos DB can support different isolation models in full technical terms. In my previous article, Understanding Multitenancy Isolation Models in Plain English, we also discussed different isolation models at the high-level in plain English (but fun approach).
How do we actually build one multi-tenant application with partition per tenant isolation model using Azure Cosmos DB?
Goal
Let’s assume we are building a simplified ticket tracking platform, i.e., a SaaS product similar to Jira or Azure DevOps. It should allow individual businesses to manage their support tickets. Each business…