CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
🌙☀️
Log inStart free
Home/Templates/SaaS & Cloud

☁️ SaaS & Cloud · C4 Architecture · Pro

Multi-Tenant SaaS Architecture

A B2B SaaS product serving many customer organisations from one platform: tenant-aware services, per-tenant data isolation, billing and admin.

More SaaS & Cloud templates

C4 Architecture diagrams are part of Pro. Anyone can view this one; generating and editing it needs Pro.

Drawing diagram…

What this diagram shows

  • Every request carries a tenant ID checked at the gateway
  • Tenant data is isolated by schema, or a dedicated database for enterprise
  • Subscription billing and feature flags per plan

Prompt used

Multi-tenant SaaS architecture: users from many customer organisations sign in through an auth service (SSO/SAML per tenant), the API gateway resolves the tenant from the subdomain and token. Services: tenant management (plans, limits, feature flags), core application services, a shared PostgreSQL with schema per tenant (dedicated database for enterprise tenants), a billing service integrated with Stripe/Razorpay, audit logging, and a background job queue.

Mermaid code
C4Container
title Multi-Tenant SaaS
Person(user, "Tenant User", "Works in their organisation's space")
Person(admin, "Tenant Admin", "Manages users and billing")
System_Ext(idp, "Customer IdP", "SSO / SAML")
System_Ext(pay, "Billing Provider", "Stripe / Razorpay")
System_Boundary(saas, "SaaS Platform") {
  Container(web, "Web App", "React", "acme.app.com")
  Container(gw, "API Gateway", "Envoy", "Resolves tenant, rate limits")
  Container(auth, "Auth Service", "Go", "Login, SSO per tenant")
  Container(tenant, "Tenant Service", "Go", "Plans, limits, feature flags")
  Container(core, "Core Services", "Node.js", "Product features")
  Container(jobs, "Job Workers", "Node.js", "Exports, emails")
  ContainerDb(db, "PostgreSQL", "Schema per tenant", "Tenant data")
  Container(billing, "Billing Service", "Go", "Subscriptions and invoices")
}
Rel(user, web, "Uses")
Rel(admin, web, "Uses")
Rel(web, gw, "Calls")
Rel(gw, auth, "Verifies")
Rel(auth, idp, "SAML")
Rel(gw, core, "Routes with tenant ID")
Rel(core, tenant, "Checks limits")
Rel(core, db, "Tenant schema")
Rel(core, jobs, "Queues work")
Rel(billing, pay, "Charges")

Related templates

DeploymentProSaaS & Cloud

Kubernetes Microservices Deployment

How a microservices app runs on Kubernetes in the cloud: ingress, namespaces, services with multiple replicas, managed databases and monitoring.

FlowchartSaaS & Cloud

CI/CD Pipeline Flowchart

A typical CI/CD pipeline from a pull request to production: build, tests, security scans, staging deploy, approval and a canary release.

SequenceSaaS & Cloud

OAuth 2.0 / OpenID Connect Login

The authorization code flow with PKCE used by most modern web and mobile apps to log users in through an identity provider.

DeploymentProSaaS & Cloud

AWS Three-Tier Web Application

The classic three-tier web app on AWS: CloudFront and a load balancer, an autoscaling app tier in private subnets, and a Multi-AZ database.

C4 ArchitectureProSaaS & Cloud

Event-Driven Architecture with Kafka

Services that talk through events instead of direct calls: an order service publishes events that inventory, payments, notifications and analytics react to.

State MachineSaaS & Cloud

SaaS Subscription Billing Lifecycle

The states of a SaaS customer's subscription: trial, active, past due with retries, paused, cancelled and expired.