Architecture
Agoda's Modular Framework Cuts API Code Reviews in Half
By organizing its post-booking API around business domains and enforcing boundaries with automated checks, Agoda achieved 64% faster code reviews while keeping its existing monolith intact.
InfoQ
Agoda has rolled out a modular monolith framework for its post-booking API that significantly reduces review overhead and tightens cross-domain dependencies—without requiring a costly system rebuild. The company paired structural discipline with automation, achieving measurable gains in development velocity.
The Problem#
BAPI, the platform handling cancellations, amendments, refunds, and customer notifications, evolved through pragmatic compromise. After splitting it out from Agoda's aging core monolith in 2019, the team prioritized speed to market over architectural clarity. That tradeoff worked initially, but pressures accumulated: merge requests more than quadrupled between 2022 and 2025, and sprawling files ballooned to over 4,000 lines each. As the codebase grew, reviewers spent more time spotting dependencies and enforcing structure manually.
A Phased Restructuring#
Rather than start over, Agoda introduced the Platform framework to gradually impose order on existing code. The framework organizes functionality by business domain—cancellations, rebooking, payments—rather than technical layers. Each domain module houses its own application, service, repository, and model layers, creating a clear boundary that localizes change and reduces coupling across teams.
The team adopted the Data Mapper pattern to shield business logic from database and API specifics, and centralized object construction in typed builders so developers know where to find or add transformations. Critically, the team encoded architectural guardrails as automated tests using ArchUnit, so violations—like a service reaching directly into another domain's repository—now fail the build during continuous integration rather than waiting for human review.
Measured Impact#
Agoda's Q2 2026 comparison between framework-backed and legacy modules revealed stark improvements:
- Median review time: 1.08 hours (framework) vs. 3.02 hours (legacy)
- Time to first substantive feedback: 10.34 hours (framework) vs. 15.77 hours (legacy)
- AI prompt efficiency: Framework-backed changes used 29% fewer AI prompts per 100 changed lines, though total prompts per merge request remained comparable

