Banksalad Refactors with DDD to Enhance AI Coding Efficiency

·2026.10.15 09:00

Key point

Converted the credit service's monolithic structure into a DDD-based architecture through 435 PRs

1 / 6

Details

The Banksalad Financial Shopping PA Server team is undergoing DDD (Domain-Driven Design) refactoring of its monolithic service to improve development efficiency in the AI coding era. The existing structure separated folders by technology and vendor, causing business logic to be overly concentrated in handlers and dependencies to become complex, creating an environment where AI struggled to understand and modify the code.

Refactoring Strategy and Structural Changes

The DDD-lite and Clean Architecture principles applied by the team are as follows:

  • Bounded Contexts: Folders are separated by business concepts (e.g., credit score) to encapsulate Go packages.
  • 4-Layer Architecture: Clearly divided into handler (gRPC entry point), application (use case assembly), domain (rules/interfaces), and infrastructure (DB/external API implementations).
  • Unidirectional Dependencies: The domain layer does not depend on external layers and is separated from infrastructure via the ports-and-adapters pattern.

After initial trial and error, the team reorganized the entire credit service over one month from June 2026 through 435 PRs. Folders containing vendor names (kcb) were removed, and external services such as KCB/NICE were moved to adapters in the infrastructure layer to ensure domain logic is not dependent on specific vendors.

Benefits from an AI Collaboration Perspective

When the structure is clear, the AI's code search scope (token usage) decreases, improving the quality of output. Since AI follows the conventions of surrounding code, it generates separated code in well-organized hierarchical structures. Additionally, if changes are confined to a single context folder, the reviewer's burden is reduced and impact analysis becomes easier. In the future, the team plans to have humans manage the structure, specify agent rules in AGENTS.md, and advance automation by developing skills such as /ddd-refactor.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.