BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Agoda Reduces API Code Review Time by 64% with Agoda Reduces API Code Review TimModular Architecture

Agoda Reduces API Code Review Time by 64% with Agoda Reduces API Code Review TimModular Architecture

Listen to this article -  0:00

Agoda has introduced a modular monolith framework in its post-booking API to reduce code coupling and enforce domain boundaries without rewriting the existing service. The approach combines component-based code organization, automated architecture checks, and incremental migration. The team reported 64% shorter median code review time and 34% shorter time to initial substantive feedback for framework-backed changes compared with legacy code.

The change addresses growing maintenance challenges in BAPI, which coordinates cancellations, booking amendments, refunds, and customer communications. Agoda extracted the API from its aging core monolith in 2019 through a largely line-by-line migration. As development increased, merge requests more than quadrupled between 2022 and 2025, while some files exceeded 4,000 lines.

The team characterized the migration as a tactical design trade-off, drawing on John K. Ousterhout's A Philosophy of Software Design,

We had deliberately traded a strategic design approach for a tactical one to prioritize speed to market. This tactical mindset was exactly what the business needed at the time.

Rather than undertake a complete rewrite, the team introduced architectural boundaries incrementally.

The framework, called Platform, organizes code around business domains such as cancellations, rebooking, and payments rather than technical layers. Each component encapsulates its business logic and data access behind defined interfaces, with application, service, repository, and model layers contained within the component. This package-by-component approach aims to localize changes and reduce dependencies between business domains.

Platform framework boundaries inside a domain module (Source: Agoda Blog Post)

Agoda uses the Data Mapper pattern to keep repository-specific models, including database entities and API payloads, out of business logic. Typed builders centralize object creation and transformations, making it easier for developers to find where domain objects and service inputs are constructed.

The team also uses ArchUnit to encode architectural constraints as automated tests in continuous integration. For example, repository-specific models can only be accessed by their respective repositories. Violations fail the build rather than relying on code reviewers to identify unauthorized dependencies manually.

The team described these constraints as architectural fitness functions, a concept discussed by Neal Ford and Mark Richards in Software Architecture: The Hard Parts. One engineer explained:

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.

Platform is now the default for new modules, while existing functionality is migrated incrementally when feature development provides an opportunity.

Agoda compared framework-backed and legacy merge requests in Q2 2026. Median review completion time was 1.08 hours for framework-backed changes, compared with 3.02 hours for legacy changes. Time to first substantive feedback was 10.34 hours versus 15.77 hours. Between June and August, framework-backed changes also used 29% fewer AI prompts per 100 changed lines, although median prompts per merge request were similar (20 vs. 22). Agoda cautioned that the AI findings were directional due to the short observation period. A related approach is Spring Modulith, which provides module verification and dependency-cycle checks for Spring Boot applications.

About the Author

Rate this Article

Adoption
Style

BT