Zenpixl
Contact Us
Back to case studies
CASE STUDY · SAAS ARCHITECTURE5 min read

How we architected a multi-tenant SaaS platform that scales to hundreds of organizations without compromising isolation

A product team needed a SaaS foundation built right from day one — multi-tenant, subscription-ready, and deployable in minutes per new client.

Type
B2B SaaS Platform
Timeline
3 Months (MVP)
My Role
Lead Architect & Developer
Architecture
Multi-tenant, Subdomain-based
THE PROBLEM

They needed a SaaS foundation, not just a web app

The client had validated their product idea with a simple prototype but knew their architecture wasn't ready for real customers. Every new client would require a separate deployment. There was no subscription billing. User roles were hardcoded. And there was no way to customise the experience per organisation without changing the codebase.

They needed a complete architectural rebuild — multi-tenant from the ground up, subscription billing integrated, and a foundation their team could build features on top of without running into infrastructure walls.

Each organisation fully isolated — data, users, settings
Custom subdomain per tenant (org.platform.com)
Subscription plans with usage limits per plan
Super admin panel to manage all tenants centrally
Onboarding flow — new org live in under 5 minutes
Role-based access within each tenant organisation
Built to scale without re-architecture
THE SOLUTION

A production-grade multi-tenant foundation built for scale from day one

We rebuilt the platform from scratch using a subdomain-based multi-tenancy approach — each organisation gets its own subdomain, its own isolated database schema, and its own configuration. No tenant can ever access another's data by design.

New organisations go through a 4-step onboarding: create account → choose plan → pay → organisation is provisioned automatically. Database schema created, subdomain activated, welcome email sent — all within 60 seconds of payment confirmation. Zero manual work.

Tenant isolation — separate database schema per organisation
Middleware-based tenant resolution on every request
Stripe subscription billing — plans, upgrades, invoices
Automated tenant onboarding — live in under 60 seconds
Super admin panel — all tenants, billing, impersonation
Role-based access control within every tenant
Usage limits enforced at API level — not just the UI
TECHNICAL HIGHLIGHTS

Why we built it this way

01

Schema-per-tenant over shared tables

We chose schema-per-tenant (separate database schema per org) over a shared table approach (tenant_id column on every table). This costs slightly more in resources but provides true isolation, simpler queries, easier tenant-specific migrations, and the ability to move a single tenant to its own server if needed later.

02

Middleware-based tenant resolution

Tenant context is resolved once at the middleware layer on every request — never scattered through application code. Every query automatically scopes to the current tenant's database connection without developers needing to remember to filter by tenant.

03

Plan limits enforced at API level

Usage limits (e.g. max 5 users on Starter plan) are checked in the API controllers — not just hidden in the UI. This prevents any client-side bypass and means the limits hold even if accessed via API key.

04

Tenant provisioning as a queued job

When a new organisation completes payment, tenant provisioning (schema creation, seeding, subdomain activation) runs as a background job. The user sees a "setting up your workspace" screen and gets redirected automatically when done — no page refreshes, no waiting on a spinner.

THE RESULTS

Live, growing, and trusted

New tenant onboarding fully automated — live in under 60 seconds
Complete tenant data isolation — schema-per-tenant architecture
Stripe subscription billing live — plans, upgrades, invoices
Role-based access control working within every tenant
Super admin panel with full tenant management and impersonation
Platform ready to scale to hundreds of tenants without re-architecture
MVP delivered in 3 months — client launched to first paying customers
TECH STACK
LaravelVue.jsNuxt.jsMySQLRedisDockerStripe APILaravel SanctumMulti-tenant ArchitectureSubdomain RoutingLaravel QueuesAWSNginxCI/CD Pipeline

Building a SaaS product and need the architecture done right?

A strong foundation saves months of painful rebuilds later. Let's design yours properly from the start.

Talk architecture