Agoda's post-booking API team has introduced a modular monolith framework that cut median code review time by 64% and time to initial substantive feedback by 34% for framework-backed changes, compared with legacy code. The framework reorganizes the existing service without a full rewrite, the team reported.
The API, which the team calls BAPI, coordinates cancellations, booking amendments, refunds and customer communications. Agoda extracted it from its aging core monolith in 2019 through a largely line-by-line migration. The problems that followed grew as development increased.
Why a 2019 migration left BAPI hard to change
The team characterized the original extraction as a tactical design trade-off. Drawing on John K. Ousterhout's A Philosophy of Software Design, the team wrote: “We had deliberately traded a strategic design approach for a tactical one to prioritize speed to market.” It added that this mindset “was exactly what the business needed at the time.”
The current work addresses the cost of that choice. It aims to reduce code coupling and enforce domain boundaries inside the service, rather than replacing it.
Merge requests quadrupled and some files passed 4,000 lines
Merge requests more than quadrupled between 2022 and 2025 as development on the API grew, the team reported. Some files exceeded 4,000 lines. Because BAPI handles cancellations, amendments, refunds and customer messaging in one service, changes in one area of the code sit next to changes in others.
The framework was built to make that growth manageable without splitting the service apart in one step.
Domain components, typed builders and ArchUnit checks
The framework combines component-based code organization, automated architecture checks and incremental migration. The building blocks the team describes include:
Domain components that organize code around business areas
Data Mapper patterns
Typed builders
ArchUnit tests that enforce layer boundaries
The team described the ArchUnit suite as an automated gate. “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.”
Review gains against legacy code
For framework-backed changes, the team reported 64% shorter median code review time and 34% shorter time to initial substantive feedback, both measured against legacy code. The approach pairs the architecture checks with incremental migration and does not rewrite the existing service.
Separately, a LeadDev survey of 500 engineering leaders, conducted with Harness, found that 57% still require human review of every line of AI-generated code. Some 29% said they spend more time reviewing code than they did before AI coding tools arrived.