The problem is not the monolith

The word “monolith” is often used as criticism. Yet many systems become hard to maintain not because they are deployed as one unit, but because they have no clear internal boundaries.

A monolith can be clean, testable and evolvable. A distributed system can be confusing, fragile and expensive.

The real topic is modularity.

Key takeaway. Before distributing a system, you need to know how to split it. Otherwise, microservices only move disorder onto the network.

What the modular monolith brings

A modular monolith keeps deployment simple while enforcing strong separation between internal domains.

The goal is to split the system into coherent modules: billing, accounts, catalog, permissions, reporting, workflows, or any other meaningful business domain.

Each module exposes a clear interface. It protects its data. It limits direct dependencies. It can be tested separately. The rest of the system does not access its core logic opportunistically.

This approach supports fast delivery, keeps the codebase readable and delays distribution until it is actually justified.

Modular monolith: one deployment, several boundaries
Application deployed together
Identity Access and roles

Exposes useful permissions, not internal tables.

Owned data
Documents Business files

Provides authorized and traceable excerpts.

Owned data
Companion AI use cases

Orchestrates requests without bypassing modules.

Explicit contract
Audit Evidence and traces

Receives minimized and usable events.

Owned data

Modules communicate through use cases, interfaces or internal events, not through opportunistic table access.

What it avoids

Microservices introduce real costs: network calls, observability, latency, API contracts, inter-service security, coordinated deployments, versioning, resilience, orchestration and operational expertise.

These costs are acceptable when they solve a real problem: strong team independence, very different load profiles, distinct availability requirements, regulatory constraints or targeted scalability.

They become destructive when they arrive before domain understanding.

Concrete example: an AI companion in a business product

Consider a common case: adding an AI companion to a business application. The wrong reflex is to spread code everywhere: a model call in the interface, some prompt logic in a controller, logs in the document service, then a trace in the user module.

In a modular monolith, this capability should have a clear boundary. For example, a Companion module can expose use cases: prepare a summary, classify a document, draft a response. It should not freely read every table or call every connector.

Other modules remain owners of their data. The document module provides an authorized excerpt. The identity module provides authorization context. The audit module records a minimal trace. The companion module orchestrates the model call and returns a proposal, not an automatic decision.

This separation makes the system easier to read. It also allows the approach to change later: local model, remote provider, asynchronous queue, human review or extraction into a separate service.

AI companion: orchestrate without breaking boundaries
1 Interface

Contextualized user request.

2 Companion module

Validates the use case, reduces context, calls the model.

3 Proposal

Reviewed before business action.

Documents

Authorized excerpt

Identity

Authorization context

Audit

Minimal trace

Model

Local or remote provider

Architecture point. An AI companion should be treated as a domain with inputs, outputs, rules and evidence. Not as a library called from anywhere.

Practical rules

A modular monolith requires discipline.

  • define modules around the business, not around technical layers;
  • prevent direct access to another module’s internal data;
  • use explicit interfaces;
  • monitor dependencies between modules;
  • keep module-level tests;
  • document decomposition decisions;
  • accept that a module may become a separate service later, but do not make that the default goal.

Technical note. The modular monolith is not an excuse to put everything in the same folder. It is an architecture with internal boundaries, contracts and dependency rules.

When to extract a service

Extracting a service becomes relevant when the boundary is already stable inside the monolith and the cost of distribution is lower than the cost of staying together.

Signals may include independent delivery cadence, strong isolation needs, very specific load, autonomous team ownership, clearly owned data and a stable business contract.

If these signals are absent, it is often better to strengthen internal modularity than to create a service.

Conclusion

The modular monolith is pragmatic: it keeps the operational simplicity of the monolith while preparing an evolvable architecture.

It does not oppose microservices. It simply avoids using them before the right boundaries are understood.

For many SMEs, internal products, business platforms and early SaaS foundations, it is often the best starting point.