Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

SaaS monolith to modular architecture: restructure first, split only when a test says so

Modernize a SaaS monolith in this order: put tests and monitoring around it, split it into modules with enforced boundaries and their own data, and run it as one deployable application. Extract a module into a separate service only when it needs its own release pace, scaling or isolation badly enough to justify running a distributed system.

Book a solution review See the related service

Reviewed by David (CEO) · Updated 1 Oct 2026 · 10 min read

star

This guide is for SaaS founders, CTOs and engineering leads whose product ships slowly because every change touches everything. It assumes a live product with paying tenants. Building a first version is covered in our SaaS MVP architecture roadmap, the wider picture in the SaaS platform engineering guide, and the general choice between rebuild, refactor and replatform in the digital transformation and modernization guide.

In this guide

Is the monolith really the problem?

A monolith is one application deployed as one unit. That is not a fault by itself: Martin Fowler's "monolith first" advice notes that almost all the successful microservice stories began with a monolith that grew too big, and that stable service boundaries are hard to draw before you know the domain. Look for these signs before you restructure anything:

  • Changes collide. Several teams edit the same files, releases wait for each other and a small fix needs a full regression run.
  • One failure takes everything down. A heavy report or import slows sign-in and billing for every tenant.
  • Nobody can explain a part. Code reaches into other code's data, so a change in one area breaks another.
  • One workload needs different treatment. Search, media processing or AI features need other hardware, scaling or release rules than the rest.

Do not restructure for a problem that is something else. Slow pages are often missing indexes, flaky releases are often missing tests and a high bill is often missing cost attribution, which our cloud cost controls guide covers. If the system is old, unsupported or opaque as a whole, run the legacy system assessment checklist first.

The target: a modular monolith before any services

A modular monolith is still one deployable application, but its code is divided into modules, each with a clear public interface and its own data. Shopify's engineering team described this approach for its large Rails application: components with defined boundaries, so that developers work in the parts relevant to them and tests can run for one component rather than for the whole. The same article lists lessons the team would apply differently if it started again, so plan for iteration.

What makes a module real, not just a folder:

  1. A public interface. Other modules call functions or send events; they never reach into internals.
  2. Owned data. Each module owns its tables. No other module reads or joins them directly.
  3. An owner. One team is accountable for the module's behaviour and its tests.
  4. An enforced rule. A check in the build fails when a module imports another's internals.

For a SaaS product, typical modules are identity and access, tenants and entitlements, billing and subscriptions, the core product domains, notifications and reporting. Tenant context travels through every module; the multi-tenant architecture guide explains the isolation choices that decision rests on.

Choosing the route

Route Strength Risk Choose it when
Harden the monolith: tests, monitoring, query and release fixes Cheapest change; often removes the symptom Structure stays tangled The pain is speed or stability, not coupling
Modular monolith in place, one module at a time One deployment, one database engine, no network between modules Needs discipline; boundaries erode without checks Coupling slows teams but scale is manageable
Extract selected services with the strangler approach Isolates a hot path or a regulated area Distributed failures, data synchronization, more operations A proven module needs its own scaling, release pace or isolation
Rewrite as microservices Clean slate for every part Longest delay, relearning old rules, features frozen Almost never; only when the old code cannot be evolved at all

Most products end up with a modular core and zero to a few extracted services. Teams should treat a full microservice estate as a destination to earn, not a starting aim.

Find the seams, then draw the boundaries

A seam is a place where one part of the code can be separated from the rest with little change. Find them from evidence, not from an architecture diagram:

  • Dependency map. Generate the real import graph. Modules with many inbound calls and few outbound ones are good first candidates; tangled cores come last.
  • Data ownership. For each table, list which code reads and writes it. Tables written by many areas show a boundary that does not exist yet.
  • Change history. Files that change together usually belong together. Files that change independently suggest a boundary.
  • Business language. Names that mean different things in different places, such as "account" in billing and in sign-in, mark the edges between domains.

Pick the first module for low risk and high learning: a clear function, a small interface and little shared data. Notifications or reporting often fit. Leave billing and identity until the method is proven, then treat them with extra care because errors there reach every tenant.

Step by step: a modularization path

  1. Make the monolith safe to change

    Add monitoring, a repeatable release and characterization tests that record what the system does today, including its odd behaviour.

  2. Map and name the modules

    Agree the list, the owner of each and the intended dependency direction.

  3. Enforce boundaries in the build

    Add rules that fail on forbidden imports. Start in report-only mode and tighten it module by module.

  4. Separate the data

    Remove cross-module joins by calling the owning module's interface, then move tables or schemas behind that interface. Keep the tenant identifier on every record.

  5. Replace internal calls with interfaces and events

    Slow or optional work, such as emails and usage events, moves to asynchronous events inside the monolith.

  6. Extract only when a test is met

    A candidate must show a measured need: its own scaling profile, its own release cadence, a security or compliance boundary, or a team that must own it end to end.

  7. Move gradually and keep a way back

    Put a routing layer in front, send a few tenants to the new component and compare results. Microsoft's strangler fig pattern describes this incremental replacement, and an anti-corruption layer keeps old and new models from leaking into each other.

Each step ships on its own. If the programme stops after step 4, the product is still better than it was.

Tenants, billing and data during the move

Multi-tenancy is where restructuring goes wrong silently. Three rules help:

  • Tenant context is not optional. Every module and every new service must receive and enforce the tenant identifier, ideally in shared code, not repeated by hand.
  • Move tenants in cohorts. Start with internal and friendly tenants, watch errors and performance, then widen. A migration that works for ten small tenants may not for one with years of data.
  • Treat billing and entitlements as a contract. Usage events and plan limits must stay identical for customers while the code under them changes. Compare invoices and entitlement results from old and new paths before switching.

Data moves need a plan for reads and writes during the transition: dual writes, change capture or a short freeze, each with a reconciliation check afterwards.

AI in a modernization

AI can speed the reading and documenting parts of a modularization while engineers keep every decision. Useful places are summarising what an undocumented module does, proposing candidate boundaries from the dependency graph and drafting characterization tests for review. Generated code and tests are merged only after a person reads them and the suite passes. Netbase works with the major commercial and open-source AI models, chosen per project. Each item below states how mature it is at Netbase.

What delivery record exists, and what does not

Netbase builds and runs multi-tenant SaaS products, which is the setting this guide is written for:

  • Cloodo Workspace. A work-management digital workplace with CRM, HRM, Cloud ERP and AI modules in one product, built and operated as a Netbase Business Division (Cloodo record).
  • Cloud ERP for a US client (not named). A multi-tenant cloud ERP that Netbase has developed since 2020 as offshore development and managing partner (cloud ERP record).
  • Printcart. The web-to-print SaaS of the Netbase Business Divisions (Printcart record).
  • Netztech. A store moved from Magento 1 to Magento 2 Commerce in 35 working days (Netztech record). It is a platform migration, not a monolith decomposition.

Netbase's delivery lifecycle includes modular and productized components, and its SaaS product accelerator is built from reusable modules.

What does not exist. No published Netbase record describes taking a live SaaS monolith apart into modules or services, and none publishes a duration, a deployment frequency, a cost or a performance result for such work. The method above comes from the cited sources and general engineering practice, not from a measured Netbase outcome.

Alternatives: who leads the work

Route Strength Choose it when
Your own team Deepest product knowledge Capacity exists and someone has done a modularization before
A product agency that also runs the product afterwards Fast start and continuity You want one party for design, change and operation
An architecture review, then a mixed team Independent view of seams and priorities before commitment The team is stretched and the order of work is unclear

Four criteria decide: whether tests and monitoring exist, how many people understand the old code, how much roadmap work must continue during the move, and who must own the architecture afterwards. Netbase starts with an architecture review of tenancy, billing, security and cost, then plans the slices. In Netbase custom development the client owns the IP created for it, and most projects run on fixed-price contracts agreed after discovery. The offer sits in SaaS development and cloud platform engineering.

Limits of this guide

  • Every codebase differs; the first dependency map often changes the plan.
  • Frameworks and languages offer different tools for enforcing boundaries; check what yours supports.
  • Sources are cited for what they document; no speed, cost or reliability figures are claimed.

Plan the next step with a Netbase consultant

Frequently asked questions

Usually not as a first step. Restructure into modules inside one application, and extract a service only for a module with a measured need for separate scaling, release pace or isolation.

It depends on the size of the code, test coverage and how entangled the data is. Netbase estimates after an architecture review and a first dependency map, and does not publish a typical duration.

Yes, if the work ships in slices and the build enforces the new boundaries as they appear. Plan capacity for both.

Assess it first. If the platform is unsupported or the rules are unknown, replatforming or discovery may come before modularization.

Next step

Tell us how the product is deployed today, how many teams change it and which part hurts most, and we will book a solution review to map the seams and propose the first module. You can also read more Netbase insights.

AI-ready SaaS development from a team that runs its own SaaS AI-ready SaaS development from a team that runs its own SaaS

Netbase provides SaaS development services for founders and product teams to launch and scale multi-tenant subscription software with AI features customers will pay for. We build and operate our own SaaS platforms, Printcart and the AI-powered Cloodo workplace, and bring that experience to client products. A typical SaaS MVP takes 8–12 weeks, depending on scope, integrations and review speed.

Learn More
line
AI-ready cloud platform engineering for SaaS and commerce workloads AI-ready cloud platform engineering for SaaS and commerce workloads

Netbase provides cloud platform engineering for SaaS and commerce teams that need a secure, repeatable home for their software and its AI features, on AWS, Google Cloud, DigitalOcean or Cloudflare. We design the architecture, write the environments as code, connect managed and AI services and hand over a platform your team can run, built the way we run ours.

Learn More
line
SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules

A SaaS product accelerator is a set of reusable Netbase modules for accounts, billing, roles and integrations that helps founders and product teams launch subscription software faster, with room for in-product AI from the first release. Reusing these modules can cut development time by up to 60%, and the approach is proven on Printcart, Netbase's own web-to-print SaaS.

Learn More
line
Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

[email protected]

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase