跳到正文
InfoQ· Leela Kumili·· 53 分鐘前AI 評分47

Agoda 以模組化架構將 API 程式碼審查時間縮短 64%

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

AI 導讀

Agoda 在預訂後 API 引入名為 Platform 的模組化單體框架,逐步建立架構邊界,無需重寫現有服務。Q2 2026 的比較顯示,使用框架的修改中位數審查完成時間為 1.08 小時,較舊有程式碼短 64%;首次收到實質意見的時間亦短 34%。

正文

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

Leela Kumili

Show moreShow less

來源:InfoQ · infoq.com