Skip to content
SaaS Development

Modular SaaS architecture: modular monoliths, microservices and add-on modules

Modular SaaS architecture splits a product into self-contained modules with clear boundaries. For most SaaS products that means a modular monolith, not microservices. How modules work, how they respect tenancy, and how to sell them as add-ons.

A modular monolith drawn as one deployable application containing six modules: accounts and tenancy, billing, the core workflow, reporting, integrations and notifications, each with its own data, joined by public interfaces and with tenant context running underneath all of them. Beside it, a smaller diagram of microservices: separate deployments talking over the network, labelled as a later step when a module needs it.

Modular SaaS architecture splits a product into self-contained modules, each owning its own data and talking to the others only through a defined interface. For most SaaS products the right form is a modular monolith: one application you deploy as a single unit, with the boundaries between modules enforced in the code. Microservices come later, if a module ever needs to run on its own.

"Modular" also has a second meaning in SaaS: modules customers buy, such as an add-on for reporting or integrations. This guide covers both, because the first makes the second much easier.

What is a modular monolith?

A modular monolith is a single application whose code is divided into modules with strict boundaries. Shopify, which moved its main codebase to this model, describes it in Deconstructing the Monolith (February 2019) as "a system where all of the code powers a single application and there are strictly enforced boundaries between different domains."

Shopify chose it over microservices because it wanted more modularity "without increasing the number of deployment units." Each of its components was meant to expose a public interface and own its data, and the team built an internal tool to track how far each component had got towards that isolation.

You get most of what people want from microservices, clear ownership and code that can change without breaking its neighbours, without running a distributed system.

What is the difference between a modular monolith and microservices?

A modular monolith keeps modules in one deployable application, while microservices run each part as a separate service that talks to the others over the network.

  • Deployment: a modular monolith ships as one unit. Microservices are deployed independently, each with its own pipeline.
  • Communication: modules call each other's interfaces in the same process. Services call each other over the network, which can be slow or fail.
  • Data: in both, each module or service should own its own tables. Microservices usually also give each one its own database.
  • Operations: one application to monitor and debug, versus many services, each needing monitoring, versioning and failure handling.
  • Team size: a modular monolith suits one team or a few. Microservices pay off when many teams need to release independently.

Martin Fowler's Monolith First (June 2015) makes the practical case: "Almost all the successful microservice stories have started with a monolith that got too big and was broken up." A well-modularised monolith is also the easiest thing to break up, because the boundaries already exist.

How do you draw module boundaries in a SaaS product?

Draw modules around business capabilities, not technical layers. A module called "billing" that owns plans, subscriptions and invoices is useful. A module called "controllers" or "database" isn't.

A typical B2B SaaS splits into something like:

  • Accounts and tenancy: sign-up, tenants, users, roles and invitations.
  • Billing: plans, subscriptions, invoices and payment events.
  • The core workflow: the one job the product exists for, sometimes split into two or three modules as it grows.
  • Reporting: read-only views across other modules' data.
  • Integrations: connections to other systems, webhooks and imports.
  • Notifications: email, in-app messages and their templates.

Then keep three rules. Each module owns its tables and no other module reads them directly. Modules call each other only through a published interface. And when something happens that other modules care about, such as a subscription being cancelled, the module announces it as an event rather than reaching into other modules to update them. Check the first two automatically in your build, so a shortcut fails the pipeline instead of slipping through review.

How do modules work with multi-tenancy?

Tenancy runs underneath every module, not inside one of them. Every module's tables carry the tenant ID, every call between modules passes the tenant it's acting for, and the database enforces separation the same way for all of them.

The accounts and tenancy module decides which tenant a request belongs to. No other module should work that out for itself, and none should be able to bypass it. That keeps the rules in one place, which is what our guide to multi-tenant SaaS architecture recommends, and it means a module added next year inherits the same protection on day one.

How do you sell features as add-on modules?

To sell modules as add-ons, record which modules each tenant is entitled to, check that entitlement on the server for every request, and connect it to billing so buying or cancelling an add-on changes access automatically.

  • Store entitlements as data: which modules each tenant has, and any limits such as seats, records or API calls.
  • Check on the server: hiding a menu item isn't access control. The module's interface should refuse calls from tenants who haven't bought it.
  • Link to billing: each add-on is its own product or price in your billing system, for example in Stripe, and payment events update the entitlement.
  • Turning a module off shouldn't delete data: make it read-only or hidden, so a tenant who re-subscribes finds everything where they left it.

Because add-ons follow the same boundaries as the code, a modular architecture makes this far simpler. Selling "reporting" as an add-on is easy when reporting is already one module with one interface.

When should a module become a microservice?

Split a module into its own service only when it has a need the rest of the application doesn't share. Common reasons:

  • It needs to scale very differently, such as a high-volume ingestion or processing pipeline.
  • It needs a different runtime, such as a machine learning model in another language.
  • It needs stronger isolation for compliance or security, such as payment handling.
  • A separate team owns it and needs to release on its own schedule.

If none of those apply, a separate service adds network calls, deployments and failure modes without solving a problem. Clean module boundaries keep the option open at almost no cost.

What does a SaaS MVP need from a modular architecture?

A SaaS MVP needs the boundaries, not the infrastructure. For a first version:

  • One application, one database, deployed as a single unit.
  • Modules for accounts and tenancy, billing and the core workflow, each owning its own tables.
  • Calls between modules only through their interfaces, checked automatically.
  • Tenant context passed through every module, with separation enforced by the database.
  • Entitlements stored as data, even if every customer has the same plan at launch.

That's the approach behind our SaaS MVP development services and our multi-tenant SaaS development services: simple to run now, and easy to extend or split later. If you're planning a product, contact us to get started.

Common questions

What is modular architecture in SaaS?

Modular architecture divides a SaaS product into self-contained parts, each owning its own data and exposing a defined interface to the others. It makes the product easier to change, because a module can be rewritten without breaking its neighbours, and it makes features easier to sell separately as add-ons.

Is a modular monolith better than microservices for a startup?

For most startups, yes. A modular monolith gives clear boundaries and ownership without the cost of running many services, which a small team rarely needs. Microservices pay off when several teams must release independently or when one part has very different scaling or compliance needs.

How do you enforce module boundaries in a monolith?

Give each module a public interface and make everything else private, stop modules reading each other's tables directly, and check both rules automatically in the build so a violation fails the pipeline. Code review alone tends to let shortcuts through under deadline pressure.

Can a modular monolith be split into microservices later?

Yes, and it's the easiest kind of system to split, because each module already owns its data and has a defined interface. Moving a module out becomes a matter of putting a network call where an in-process call used to be, and moving its tables to their own database.

How do add-on modules affect billing?

Each add-on becomes its own product or price in your billing system, and payment events update which modules a tenant is entitled to. Access is checked on the server, so a cancelled add-on stops working at once, and the data stays in place in case the tenant buys it again.

Want something like this built and run in your own accounts? That's what our SaaS Development service does. You can also see everything we build or look through our case studies.

2Keep reading

More from the studio.

Ready to build something that pays for itself?

Tell us what you need and get a written scope, timeline and fixed quote within 48 hours of a free 30-minute call, whether you work with us or not.

Replies within 24 hours · NDA on request · No commitment