Insights
Modular Monolith: A Practical Guide to Architecture That Scales Without Microservices

Architecture debates tend to offer two doors. Behind one, the monolith: simple to build, simple to deploy, and, in the horror stories, impossible to change by year three. Behind the other, microservices: independent, scalable, and carrying a distributed-systems bill that arrives whether you needed the independence or not. Most product teams are standing in front of a third door they have not been shown.
That door is the modular monolith: one application, one deployment, but internally divided into business modules with explicit contracts, controlled dependencies, and data that has exactly one owner. It keeps the operational simplicity that makes monoliths attractive while removing the uncontrolled coupling that makes them feared.
A modular monolith is a single deployable application organized into independent business modules, each with a small public contract, controlled dependencies, and clear data ownership. It keeps deployment and in-process communication simple while preventing the coupling that makes traditional monoliths hard to change, which makes it the practical middle path for most evolving products.
Key takeaways:
- “Monolith” describes how a system is deployed, not how well it is organized. One artifact can have excellent internal separation, and twenty services can still be one tangled system.
- The four defining properties are: one deployable unit, modules organized by business capability, explicit contracts between them, and boundaries enforced by automated checks.
- A shared database is compatible with this architecture. Shared ownership of data is not. Every table needs exactly one module allowed to write it.
- Microservices solve real problems, independent scale, release, isolation, ownership, but charge a premium for them. Pay it only when the problem is measured, not anticipated.
- A module becomes a service on evidence, in at least one of scaling, release autonomy, isolation, specialization, or ownership, never on codebase size or fashion.
When a product’s architecture starts deciding how fast the business can move, getting this choice right early is far cheaper than reversing it later. It is the kind of decision our custom software development team helps clients make with evidence: boundaries mapped, trade-offs priced, and a structure their own engineers can own afterwards.
This guide defines the architecture, prices both alternatives honestly, walks through how it works inside, names its failure modes, gives a ten-step design process and a governance checklist, and ends with the extraction test: how to know when a module has genuinely outgrown the monolith.
What Is a Modular Monolith?
A modular monolith is one application and one deployment unit whose code is divided by cohesive business capability. A commerce platform might hold catalog, ordering, payments, fulfillment, and identity modules. Each module owns its internal logic and data, and exposes only a small public contract. Other modules work through that contract instead of importing private classes or querying tables they do not own.
The defining insight is that “monolith” describes deployment topology, not code quality. A system can ship as a single artifact and still have excellent separation. The mirror image also exists: a codebase split into many services that remains tightly coupled, sharing a database, releasing in lockstep, failing together, is a distributed monolith, which collects the costs of distribution and the costs of coupling at the same time. The question that decides architecture quality is not how many deployables you have. It is whether boundaries reduce the reasons one area must change when another changes.
Four properties define the style:
- One deployable unit. The application is built, versioned, released, and usually scaled as a whole.
- Business-oriented modules. Boundaries follow capabilities or bounded contexts, not horizontal technical layers like a system-wide controllers folder.
- Explicit contracts. Modules communicate through approved application interfaces, commands, queries, or events.
- Enforced isolation. Automated dependency rules, architecture tests, and data-access policies stop boundary violations at build time, not in a wiki page.
Folders alone create none of this. If billing code can reach into ordering entities, update catalog tables, and call private notification helpers, the system is coupled, whatever the directory tree claims. Modularity is a property of what the code is prevented from doing, not of how it is filed.
Why Teams Look for a Middle Path
Traditional monoliths are genuinely attractive at the start, and it is worth saying why. A developer can run the whole product locally. Transactions stay inside one process. Debugging follows one execution path. Deployment has few moving parts. Those advantages do not disappear because the application has one deployment unit; they disappear when the codebase degenerates into a big ball of mud, where every change can touch everything and nobody can predict the blast radius.
Microservices fix that class of problem by buying independence: a capability can deploy, scale, run, fail, and be owned separately. As Martin Fowler’s well-known analysis puts it, those benefits charge a microservice premium. Remote calls fail in ways function calls do not. Data separates, so cross-service transactions become workflows and sagas. Observability has to stitch many components together, and every service needs its own secure delivery path. None of that is an argument against microservices. It is an argument for paying the premium only when the independence is actually needed.
The modular monolith exists because most teams need the boundary discipline now and the independence, if ever, later. A widely reported example of the bill coming due: Amazon’s Prime Video engineering team consolidated one distributed monitoring service back into a single process and reported cutting that service’s infrastructure costs by around 90 percent. One team’s workload is not a law of nature, but it is a reminder that distribution is a cost center you opt into, not a badge of seriousness.
Traditional Monolith vs Modular Monolith vs Microservices
| Decision area | Traditional monolith | Modular monolith | Microservices |
|---|---|---|---|
| Deployment | One unit | One unit | Multiple independent units |
| Internal boundaries | Often informal | Explicit and enforced | Process and network boundaries |
| Communication | Direct internal calls | Contracts and internal events | Remote APIs and messaging |
| Data model | Common access | Ownership by module, even in one database | Ownership by service |
| Transactions | Usually simple ACID | Local transactions remain practical | Often eventual consistency or sagas |
| Scaling | Scale the whole application | Scale the whole application by default | Scale services independently |
| Failure isolation | Shared runtime | Shared runtime | Stronger, when designed correctly |
| Team autonomy | Limited by coupling | Clear ownership, coordinated release | Independent ownership and release possible |
| Operational load | Low initially | Moderate and controlled | Highest, due to distributed operation |
| Best fit | Small, simple, short-lived systems | Evolving products needing maintainable boundaries | Mature domains with proven independence needs |
Read the table as a map of constraints, not a league table. “Traditional monolith” here means a monolith with informal boundaries, not every one-unit application. A service boundary does not guarantee autonomy or fault isolation, and the right architecture is the least complex option that satisfies your current reliability, scale, ownership, security, and delivery requirements.

Figure 1: The five controls that turn folders into modules. The figure simplifies: the controls reinforce each other, and removing any one of them quietly returns the system to an informal monolith.
How the Architecture Works
Modules follow business capabilities
A module should represent a coherent business responsibility: subscriptions, claims, inventory, identity. It often aligns with a bounded context from domain-driven design, a boundary inside which terms, rules, and data carry one consistent meaning, though not every module is a full bounded context. Organizing by capability keeps related behavior together, instead of spreading every feature across system-wide controller, service, and repository layers. Start by mapping business events, commands, policies, and data ownership. If one capability can change without repeatedly forcing changes in another, it is a good module candidate. If two areas share rules and transactions on nearly every workflow, separating them buys ceremony, not independence.
Public contracts hide implementation details
Each module needs a deliberately small public surface: application services, commands, queries, immutable data transfer objects, or published events. Internal entities, persistence models, helper classes, and schema details stay private. The test is simple to state and hard to fake: could you rewrite the module’s internals, including its storage, without any other module’s code changing? If not, the contract is leaking, and the leak, not the module count, is the problem to fix.
Dependencies move in one direction
Cycles are a design confession. If ordering depends on payments while payments imports ordering internals, neither can evolve independently, and the boundary between them is fictional. Tooling in several ecosystems can now verify module structure automatically, rejecting cycles and references to module internals in CI; Spring Modulith is the best-known example in the Java world. Know the limit of such checks: they police code structure, not every SQL query or runtime data path, so data rules need their own enforcement. Where a cycle appears, define allowed directions explicitly, extract the genuinely shared concept, or use an event to remove the reverse call.
Data has an owner
A shared database is compatible with this architecture; shared ownership is not. Large engineering organizations that run modular monoliths in production, GitLab among them, describe exclusive data ownership plus intentional public APIs as explicit design goals. Give every table or schema one authoritative module. Other modules request behavior through the contract or read published data; they never write another module’s tables directly. Cross-module joins are the seductive shortcut: fast to write today, they weld consumers to storage details and make tomorrow’s changes expensive. For reporting, use approved read views, a reporting store, or replicated projections instead of letting operational modules graze in each other’s schemas.
Communication can be synchronous or event driven
Use a direct in-process call when a caller needs an immediate answer inside one user operation. Use an internal event when another module reacts to something that has already happened, an OrderPlaced event triggering fulfillment and notifications. But be precise about event semantics: internal events are not automatically asynchronous or durable. A synchronous listener may run inside the originating transaction; an after-commit listener runs separately and can lose work if delivery is not persisted. For work that must survive failure, use a transactional outbox or durable publication mechanism, retries, idempotent consumers, and monitoring for failed deliveries. Choosing events everywhere, by default, is how teams import distributed-systems problems into a single process and get the complexity without the independence.
One deployment also does not remove production engineering. The application still needs health checks, structured logs, traces, metrics, safe migrations, rollback procedures, capacity planning, and tested recovery, with module identity tagged into the telemetry so errors, latency, and resource use can be charged to the capability that caused them.
Benefits That Matter in Practice
Faster development without network friction. Developers run and debug the whole application locally instead of starting a fleet of services. Calls stay in process, so teams avoid network latency, serialization, timeouts, retries, and contract versioning for interactions that never needed a remote boundary.
Simpler consistency. Important workflows can use one local database transaction when the business requires atomic behavior, provided the participating data shares one transactional resource and the owning modules join through their contracts. Financial posting, inventory reservation, and permission changes are the classic beneficiaries. Microservices can support the same workflows, but usually with compensating actions, sagas, and explicit handling of partial failure, which is real engineering spent on a problem the monolith does not have.
Better evolvability than an unstructured monolith. Clear ownership narrows the blast radius of change. A team can replace a module’s algorithm, persistence approach, or internal model while its contract holds steady. Tests can target module behavior, and dependency analysis shows where coupling is creeping before it becomes the architecture.
Limitations and Failure Modes
The honest costs of a modular monolith first: its modules share a process, a release, and a default scaling model. A memory leak in one module can take down the whole application. A single high-traffic capability normally means scaling the entire runtime. Teams coordinate a common release even when module ownership is separate. If those constraints bite hard and measurably, the extraction section below is the answer; until they do, they are the price of simplicity, and usually a fair one.
The failure modes are mostly ways of pretending:
- Feature folders without enforcement, where code bypasses public interfaces whenever a deadline approaches.
- A shared-domain dumping ground, where generic models and utilities become hidden coupling between every module.
- Database shortcuts, where modules read or write tables they do not own.
- Cyclic dependencies, where responsibilities were split incorrectly or orchestration has no clear home.
- Chatty internal APIs, where boundaries are drawn too fine and every workflow bounces between modules.
- Premature events, where asynchronous patterns add complexity with no consistency or decoupling benefit.
- Assumed extractability, where package separation is treated as proof a module is ready to become a service.
Governance is the counterweight: a lightweight architecture decision record per module, covering responsibilities, allowed dependencies, interaction patterns, data owners, and exceptions, with CI verifying every rule a tool can verify.
How to Design One, Step by Step
Step 1: Map business capabilities. Interview domain experts and trace real workflows, business rules, events, and ownership before drawing a single box.
Step 2: Define module responsibilities. Write down what each module owns, exposes, consumes, and must never access. The “never” list does as much work as the rest.
Step 3: Design public contracts. Prefer business commands and queries over shared persistence abstractions, and keep the surface as small as the workflows allow.
Step 4: Assign data ownership. Give every operational table, migration, and write path exactly one owner.
Step 5: Choose interaction patterns. Direct calls for immediate decisions, events for independent reactions, with durability engineered where the reaction must not be lost.
Step 6: Create dependency rules. Enforce package, project, or namespace boundaries in CI from the first month, not after the first violation becomes load-bearing.
Step 7: Test at several levels. Unit tests, module integration tests, contract tests, and a deliberately small end-to-end suite.
Step 8: Add module-aware telemetry. Tag logs, traces, metrics, and incidents with the owning capability, so operations can see the architecture too.
Step 9: Measure delivery effects. Track lead time, change failure rate, build duration, boundary violations, and incident scope, and watch the trends rather than any single number.
Step 10: Review boundaries as the domain changes. Refactor modules when evidence shows responsibilities have moved. Boundaries are hypotheses; the domain grades them.
Teams working through these steps on an existing codebase often want an outside pair of eyes on steps 2 and 4, where internal politics most distorts the map. That assessment work, comparing architecture options, mapping dependencies, and sequencing the modernization, is part of our custom software development practice.
Testing and Governance Checklist
Use this checklist at architecture reviews and release planning:
- Does every module map to a recognizable business capability?
- Is its public interface smaller than its internal implementation?
- Can the build detect prohibited imports and dependency cycles?
- Does every table and migration have one accountable owner?
- Do cross-module writes happen only through an approved contract?
- Are events named as completed business facts and handled idempotently?
- Can each module be integration-tested without driving the entire user interface?
- Do telemetry and alerts identify the module, the operation, and the business impact?
- Are exceptions documented with an owner and a removal date?
- Is service extraction decided on measured operational need rather than codebase size?
The metrics behind the checklist are architecture fitness functions: counts of boundary violations, cyclic dependencies, cross-module database accesses, module test duration, deployment lead time, and incidents that spread across capabilities. A trend line on any of these tells you more than a one-time architecture score ever will.
When to Choose This Architecture
Choose it when the domain is still evolving, when one coordinated release is acceptable, and when a single team or a few closely aligned teams own the system. It fits workflows that benefit from local transactions and workloads that scale reasonably as one unit. Its strongest property is strategic: it keeps future options open, including extraction, without paying today for a distributed platform the product may never need.
Do not choose it merely to postpone thinking. If a capability already carries strict isolation duties, regional data residency, specialized hardware, a materially different availability target, or a genuinely independent release cadence, a separate service may be justified today, and forcing it into the monolith just defers a harder extraction.
When Microservices Are the Better Choice
Microservices earn their premium when independence is a present requirement and the organization can actually operate it. The strong signals:
- One capability must scale differently enough to justify separate infrastructure.
- Teams need to deploy on independent schedules without coordinated releases.
- A regulatory, security, or fault boundary requires process-level isolation.
- A workload needs a different runtime, data technology, or hardware profile.
- The domain boundary has stayed stable through repeated product changes.
- A team can own code, data, deployment, reliability, and incident response end to end.
Notice what is not on the list. Application size alone is a weak reason; a large, well-factored application is often easier to operate than dozens of small services. Team count alone is equally weak, since services that share a database, release together, or change in lockstep deliver coordination costs without autonomy. Independence is the product microservices sell. If you are not receiving it, you are only paying for it.
When Should a Module Become a Service?
Fowler’s monolith-first argument is the frame here: successful service architectures usually began as monoliths, because boundaries are learned from a running system, not divined in a design workshop. He is candid that the evidence is anecdotal and alternatives exist, so treat it as disciplined guidance, not law. Inside this architecture, the extraction rule is: extract only when the new operational boundary solves a measured problem. Require evidence in at least one area: independent scaling, release autonomy, fault containment, security isolation, technology specialization, regional deployment, or separate team ownership.
Before extracting, verify the module’s hygiene: it owns its data outright, its contract is stable, no consumer reaches into its private implementation, and its tests are strong enough to catch regressions across what is about to become a network. Internal callers using the public contract are expected; they need a deliberate migration plan, not a surprise. Then design the distributed consequences on purpose: authentication, authorization, network failure, timeouts, retries, idempotency, versioning, tracing, deployment, and eventual consistency. If those costs exceed the expected benefit, keep the capability inside the application and record why. When the evidence does clear the bar, sequencing that first extraction safely is exactly the sort of work our custom software development team plans with clients, one module at a time, with the monolith still shipping throughout.

Figure 2: The extraction signals. One strong, measured signal can justify a service; a large codebase, on its own, is not one of them.
Conclusion
A modular monolith is not a compromise and not a set of unfinished microservices. It is a deliberate design: one operational unit, business-aligned modules, explicit contracts, controlled dependencies, and accountable data ownership. It works best when a team needs speed and transactional simplicity while protecting the codebase from the coupling that quietly taxes every future change. Define the boundaries, enforce them automatically, watch the module-level evidence, and distribute only what proves it needs independence.
If you are weighing this decision on a live product, or untangling a monolith that has already become the bottleneck, contact Denebly and we will work through the trade-offs with you: sales@denebly.com or +1 (214) 896-2906. Bring the dependency graph. That is where the honest conversation starts.
Frequently Asked Questions
Is a modular monolith the same as a traditional monolith?
No. Both deploy as one application, but this architecture has explicit business modules, restricted dependencies, public contracts, and deliberate data ownership. A traditional monolith may have layers or folders without any rules preventing unrelated areas from reaching into one another, and the difference shows up the first time a small change breaks a distant feature.
Is it always a temporary step before microservices?
No. It can be the long-term architecture whenever one deployment and a shared runtime meet the product’s needs. Extraction should happen only when independent scaling, release cadence, isolation, or ownership creates enough value to justify distributed complexity, and for many products that day never needs to come.
Can modules share one database?
Yes, provided ownership is unambiguous. Each module should be the only writer to its tables or schema. Other modules use its contract or an approved read model rather than depending on private storage details, which keeps a later extraction, or a storage change inside the module, from breaking its neighbours.
How do modules communicate?
Through their public contracts: synchronous in-process calls when a caller needs an immediate answer, and internal events when another module reacts to something that has already happened. The choice follows consistency, latency, and coupling needs, and both styles should use stable contracts with observable execution paths.
Can a modular monolith scale?
Yes. Teams run multiple application instances behind a load balancer, and lean on caching, queues, background workers, and database scaling techniques, exactly as with any monolith. What it does not offer by default is independent scaling of a single module; a proven need for that is one of the legitimate extraction signals.
How do you prevent boundaries from eroding?
In a modular monolith, you combine clear ownership with automated enforcement. CI should reject prohibited imports, dependency cycles, and unauthorized data access. Architecture tests, code review, module-level tests, and periodic dependency analysis keep the intended structure visible, and documented exceptions carry an owner and a removal date so they cannot quietly become the design.
What is a distributed monolith?
It is the worst of both worlds: a system split into separate deployables that remains tightly coupled. Its services share a database, require coordinated releases, or lean on long synchronous call chains, so it carries the full operational cost of distribution without achieving meaningful autonomy, failure isolation, or independent change.
What should teams measure after adoption?
Boundary violations, dependency cycles, change lead time, build and test duration, change failure rate, incident scope, module-level latency, and cross-module data access. Success looks like safer changes and clearer ownership in the numbers, not merely a tidier folder tree in the repository.
Sources
- Martin Fowler, “Monolith First”. The classic argument for starting with a monolith and learning the boundaries before distributing them, presented by its author as experience-based guidance rather than settled proof.
- Martin Fowler, “Microservice Premium”. The source of the premium concept used throughout this guide, including the advice to pay attention to good modularity inside the monolith.
- Wikipedia, “Monolithic application”. A neutral overview of monolithic applications and their patterns, which lists the modular monolith among them.
Framework and platform material, notably Spring Modulith’s module verification and event handling, and published engineering-handbook accounts of data ownership in large modular monoliths, informed the mechanics sections. Those are project and vendor sources, described in the text and, under this site’s external-link rule, not linked.
WRITTEN BY
Arslan Mushtaq
Founder, Denebly
Arslan founded Denebly in 2018 and leads its AI development work for startups and mid-size businesses, across AI chatbots, agentic workflows, RAG systems, machine learning and automation. Denebly has delivered 100+ projects from Dallas, Texas.
Ready to Solve Your Business Problems With AI?
Tell us what you are trying to build, automate or fix. You will get an honest assessment within one business day, not a sales pitch.