Is implementing good architecture leading to better outcomes newsworthy?
That was the top comment on Reddit when Agoda’s results hit the wire. It’s a fair question. It’s also the exact kind of question someone asks right before their team ships another four-thousand-line file to production.
Yes, good architecture leads to better outcomes. But Agoda’s case isn’t just another “we did the obvious thing and it worked” story. The company applied architectural discipline to an existing, aging system, without a rewrite, without a migration to microservices, and without stopping feature work. The results are hard to argue with: a 64% reduction in median code review time for framework-backed changes.
That’s not a rounding error. That’s a fundamental shift in how fast a team can ship.
The Backstory: A Tactical Trade That Turned Into a Tax
Agoda’s post-booking API (BAPI) is the kind of system every travel company eventually ends up with. It handles cancellations, booking amendments, refunds, and customer communications. It’s not glamorous. It’s absolutely critical.
The team extracted BAPI from the aging core monolith in 2019 through a mostly line-by-line migration. The trade was deliberate. They leaned on John K. Ousterhout’s A Philosophy of Software Design and admitted it plainly: “We had deliberately traded a strategic design approach for a tactical one to prioritize speed to market.”
That tactical mindset paid off at first. But between 2022 and 2025, something started to break. Merge requests more than quadrupled. Some files ballooned past 4,000 lines. Every change felt like it touched everything. The team was paying a “coupling tax” on every single feature.
Sound familiar?
The Modular Monolith Framework: Boundaries Without the Network
Here’s where Agoda’s story diverges from the usual “let’s split into microservices” playbook. Instead of adding network boundaries, they added code-level ones.
The team built a framework they call Platform. It organizes code around business domains, cancellations, rebooking, payments, rather than technical layers. Each component encapsulates its business logic and data access behind defined interfaces. This is the package-by-component approach, and it’s the same pattern Shopify uses in its 2.8-million-line Rails monolith, which the company describes as “strictly enforced boundaries between different domains.”
The structure is deceptively simple:
- Each module exposes a public facade (the only thing other modules can import)
- Everything else lives in
internal/ - Modules communicate through public APIs or events
- Each module owns its database schema
- A CI check enforces every boundary
The results in Q2 2026 are worth a table:
| Metric | Framework-backed | Legacy code |
|---|---|---|
| Median review completion time | 1.08 hours | 3.02 hours |
| Time to first substantive feedback | 10.34 hours | 15.77 hours |
That’s the 64% and 34% improvements. But here’s the part that should make every architect sit up: framework-backed changes also used 29% fewer AI prompts per 100 changed lines. The team notes the AI findings are directional, but the implication is clear, when code has clear boundaries, even AI assistants do their job better.

The Enforcement Trifecta: Architecture as Fitness Functions
Here’s the uncomfortable truth about modular monoliths: without enforcement, they rot into a “big ball of mud” faster than a classic monolith. The boundaries are purely conventional. Nothing stops a developer from importing another module’s internals.
Agoda knew this. They used ArchUnit to encode architectural constraints as automated tests in CI. Repository-specific models can only be accessed by their respective repositories. Violations fail the build. No exceptions, no “just this once.”
The team called these “architectural fitness functions”, borrowing the concept from Neal Ford and Mark Richards in Software Architecture: The Hard Parts. One engineer put it bluntly: “By codifying our layer boundaries into an ArchUnit test suite, our CI pipeline serves as an automated guardrail, catching structural drift on every pull request before a human reviewer ever sees it.”
This isn’t new. But the enforced discipline is exactly what separates a modular monolith from a monolith with good intentions.
The Trade-Off Matrix: What You Actually Give Up
The modular monolith is not a magic bullet. It’s a set of trade-offs that happen to be better for many teams. Let’s look at the honest comparison:
| Classic monolith | Modular monolith | Microservices | |
|---|---|---|---|
| Deployables | 1 | 1 | many |
| Module boundaries | conventions | enforced by tools (CI + runtime) | enforced by the network |
| Cross-module call | function call | function call through a facade | HTTP/gRPC or a broker |
| Data ownership | shared tables | schema per module, no cross-schema reads | database per service |
| Consistency | one transaction | one transaction plus outbox events | sagas, eventual consistency |
| Cost of a wrong boundary | low, but boundaries blur | low: move code, rerun the linter | high: API versioning, data migration |
The last row is the hidden gem. With a modular monolith, when you get a boundary wrong, you move code and rerun the linter. With microservices, you’re rewriting APIs and migrating data. The cost of being wrong is exponentially higher.

How to Actually Enforce Boundaries (Without Losing Your Mind)
The DEV community has been running with this idea. One of the best practical breakdowns came from Kate Steele, who built a modular monolith in Python with real, working boundary enforcement. The key insight? Python has no private modules, so conventions fail. You need machines to check what humans will ignore.
The setup uses import-linter with a set of contracts, each catching a different failure mode:
- layers: Higher layers may import lower ones, never the reverse, including indirect imports. This blocks cycles between modules.
- protected: A module’s
internalpackage can only be imported by itself. This catches “just this once” shortcut imports. - forbidden: Domain modules must not import infrastructure. This keeps business logic pure.
- independence: Event schemas must not import each other, so they can be extracted into a service later.
- acyclic_siblings: No cycles between sibling packages, with a report telling you which edge to cut.
The “before” state showed exactly what happens without enforcement, five broken contracts out of eight. The most instructive failure: a layers contract caught a cycle but missed a module reaching into another’s internals for an email address. Only the protected contract caught that one.
The fix wasn’t complicated. Events for “something happened”, facades for “answer my question.” Billing subscribes to AccountCreated instead of reading the accounts table. It violates nothing, and the contracts go from five broken to zero kept.

The Database Is Part of the Boundary
Import rules stop Python code from crossing boundaries. They do nothing about SQL. A JOIN across modules is invisible to a linter and acts as tight coupling.
The answer is one database with one schema per module. In PostgreSQL, give each module its own role and grant access only to its schema. A cross-module query fails with a permission error. In SQLite, you can emulate this with an authorizer callback, which is what the Python example does.
This matters more than most architecture discussions give it credit for. When Shopify says its modular monolith has “strictly enforced boundaries between different domains”, they’re not talking about just imports, they’re talking about data.
When Should a Module Become a Service?
The modular monolith isn’t a waiting room for microservices. Many products should never split. But the boundaries make extraction cheap when a real signal appears, not when someone has a hunch.
The five signals worth paying attention to:
- Different scaling profile: One module needs GPUs or 10x the replicas, and scaling the whole app costs real money.
- Different release cadence or failure isolation: A module’s deploys keep blocking unrelated work.
- Team ownership: A separate team owns the module end-to-end and coordination on the shared deploy is the bottleneck.
- Compliance scope: Card data, health records, regional data residency, where shrinking the audited surface is worth a network boundary.
- The seams are already clean: All incoming traffic goes through the facade, events are published through an outbox, isolated tests pass with fakes.
If any of those five signals is real and measured, extraction is a mechanical job. The facade becomes a client for the new service’s API. The outbox gets a relay to a broker. The module’s schema moves to its own database. Calling code doesn’t change.

The Outbox: Your Escape Hatch
There’s one pattern that makes the modular monolith genuinely viable as a long-term architecture: the transactional outbox. Every event is written to an outbox table in the same transaction as the business data. A dispatcher delivers events later, one handler per transaction. If the handler fails, it’s retried. If it succeeds, an inbox record makes the retry a no-op.
This is the pattern that lets you move a module to a service later without changing a single line of publisher code. The dispatcher becomes a relay to a broker. The handlers run as queue consumers. The inbox logic moves with them.

The Feedback Loop: Why Agoda’s Numbers Matter
There’s always someone who asks whether architectural investment is worth it. Agoda just gave you the answer with measurements. A 64% reduction in code review time isn’t a fluff metric, it’s the difference between shipping a feature on Thursday and waiting until Monday.
The skeptics say the industry is in an architecture bubble and everyone already knows this. But the fact is, most developers just want to get work done. They say “Who cares? AI is writing the code”, or argue that best practices don’t matter anymore. Agoda’s data gives you something concrete to point to when you’re fighting to split that god class or enforce a boundary.
This is also part of a bigger story. When teams look at why modular monoliths are increasingly favored over microservices for maintainable backend architecture, they’re really asking a question about where complexity should live. The network is a powerful tool, but it’s a tool you should reach for when you can name the problem it solves. If your services must deploy together, share data, and call each other in chains, you’re paying for independence you don’t have.
The real-world case studies of successful modular monolith implementations at scale tell the same story. Shopify runs a massive Rails monolith with enforced boundaries. A Prime Video team consolidated a distributed monitoring pipeline into a single process and cut costs by 90%. Segment merged 140+ services back into fewer, simpler deployments.
The Bottom Line
Agoda’s 64% improvement isn’t about monoliths versus microservices. It’s about treating architecture as something you enforce, not something you document. The moment boundaries become machine-checked, they become real. The moment they’re real, developers stop tripping over each other.
For teams considering their options, the trade-offs involved in enabling communication between modules in a modular monolith are increasingly one-sided. You keep one deployable, one transaction, one debugger session. You get module boundaries that survive deadline pressure because CI and the database enforce them instead of code review.
Not bad for a “compromise” architecture.




