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")

Inside this diagram

A C4 architecture diagram of Multi-Tenant SaaS with 2 people, 8 building blocks, 2 outside systems and 10 relationships.

People

  • Tenant User: Works in their organisation's space
  • Tenant Admin: Manages users and billing

Inside the system

  • Web App (React): acme.app.com
  • API Gateway (Envoy): Resolves tenant, rate limits
  • Auth Service (Go): Login, SSO per tenant
  • Tenant Service (Go): Plans, limits, feature flags
  • Core Services (Node.js): Product features
  • Job Workers (Node.js): Exports, emails
  • Billing Service (Go): Subscriptions and invoices

Databases and queues

  • PostgreSQL (Schema per tenant): Tenant data

Outside systems

  • Customer IdP: SSO / SAML
  • Billing Provider: Stripe / Razorpay

Boundaries

  • SaaS Platform

How they connect

  • Tenant User β†’ Web App: Uses
  • Tenant Admin β†’ Web App: Uses
  • Web App β†’ API Gateway: Calls
  • API Gateway β†’ Auth Service: Verifies
  • Auth Service β†’ Customer IdP: SAML
  • API Gateway β†’ Core Services: Routes with tenant ID
  • Core Services β†’ Tenant Service: Checks limits
  • Core Services β†’ PostgreSQL: Tenant schema
  • Core Services β†’ Job Workers: Queues work
  • Billing Service β†’ Billing Provider: Charges

Make your own diagram like this

Describe your own system in plain English and the AI C4 diagram generator draws it in seconds, in the same style as this template.

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.