From Side Project to Platform: Our Multi-Tenancy Journey

Three failed attempts at multi-tenancy taught us more than any design doc. Here's how we finally turned a single-tenant SaaS into a true platform.

Siddhartha Lahiri · · 3 min read

The uncomfortable truth about architectural decisions? There's no such thing as a "pure" one.

Last year, we completed something our organization had attempted multiple times before and failed: transforming our single-tenant B2B SaaS platform into a true multi-tenant architecture.

The Problem We Could No Longer Ignore

Every client deployment had spawned its own codebase. Infrastructure was duplicated everywhere. Security patches required coordinating across multiple parallel systems.

But here's what made this terrifying: we were sitting on 2+ million lines of code. Seven years of battle-tested business logic, complex algorithms, and hard-won domain expertise. This wasn't legacy code we could walk away from—it was the product.

Why We Kept Failing

We'd attempted multi-tenancy before. Multiple times. Each attempt followed the same pattern: treat it as a new project, build a fresh codebase, migrate clients over once it's "ready."

Each attempt died the same death. Stakeholders couldn't get confident that a rewrite would replicate everything. Multi-tenancy became a side project that never went live.

We were violating Gall's Law without realizing it:

"A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works."

We kept trying to design a complex multi-tenant system from scratch. We needed to evolve the one that already worked.

The Realization That Changed Everything

After the third failed attempt, the mindset shifted: what if we stopped trying to replace the system and started transforming it from within?

The goal wasn't to build a new multi-tenant platform. It was to make the existing platform multi-tenant—same code, same battle-tested logic, new architecture underneath.

"For each desired change, make the change easy (warning: this may be hard), then make the easy change."

We weren't rewriting. We were making multi-tenancy possible within the existing system, then executing it.

The Execution

Pattern 1: Logical Tenancy (Shared Database, Shared Schema)

We introduced TenantID across the existing product—creating logical separation over physical infrastructure. This is the highest-density multi-tenant model: all tenants share the same database and schema, isolated by a discriminator column.

The testing was brutal—weeks of validation to ensure tenant boundaries held across every workflow.        

Pattern 2: Defense in Depth

With millions of lines of code, we couldn't trust refactoring alone. One missed query and tenant data could leak.

So we enforced tenancy outside the application layer. We deployed ProxySQL to validate every query for tenant isolation at the database level—a safety net independent of application code. Combined with mixins and token-based isolation in the application layer, we had multiple barriers, each assuming the others might fail.

Pattern 3: Strangler Fig

With the core platform now multi-tenant, we adopted the Strangler Fig pattern for modernization. New features were built as independent services (NextJS, Python). Old modules were gradually decommissioned.

The legacy system didn't need to be killed. It could be absorbed, piece by piece, with each new service inheriting the multi-tenant foundation.

Bringing Stakeholders Along

Previous attempts had long build phases before anything was demonstrable. This time, every step produced visible evidence—a tenant successfully isolated, a query policy catching a violation, a new service running independently.

No architecture decks. No six-month roadmaps. Working isolation, demonstrated weekly. Confidence built incrementally.        

Closing the Loop

Remember where we started? Multiple codebases per client—now one unified codebase. Security patches that took weeks—now a single deployment with instant rollout. New client setup that stretched 4-6 weeks—now a tenant goes live in hours. Upgrades that were coordination nightmares—now one upgrade path, one test suite.

What This Actually Enables

  1. Scale without linear cost. Adding a client no longer means new infrastructure.
  2. Speed to market. Features ship once and reach everyone. Quarterly releases became continuous deployment.
  3. Freedom to modernize. The strangler pattern only works when you have a unified system to strangle into. Now we do.

The Real Lesson

If I had to distill this journey into one insight:

Multi-tenancy isn't an architecture decision. It's an organizational capability.

The technology matters—logical isolation, query enforcement, token-based separation. But the reason we failed three times wasn't technical. It was because we treated multi-tenancy as a project rather than a transformation.

Projects have end dates. Transformations change how you operate.

The teams that succeed at this aren't the ones with the cleverest architecture diagrams. They're the ones who figure out how to evolve a living system while it's running—and bring their organization along for the journey.


We spent years learning these lessons the hard way. If you're navigating a similar transformation, I'd genuinely love to hear what's working for you.

First published on LinkedIn. Join the discussion there →