How feiniaojin/ddd-hcms works
Main Components
• Domain Layer – Represented by the module “ddd-hcms-domain.” It contains all the core domain models (e.g., EntryEntity, TypeEntity), domain services, repository interfaces, factories, value objects (e.g., EntryId, DictVo), and enums. This layer is central to DDD.
• Application Service Layer – Found in “ddd-hcms-application-service.” It includes application logic such as command services, query services (for entries, entry fields, types, type fields), command objects, DTOs, and factories interacting with the domain layer.
• Infrastructure Layer – There are several infrastructure modules, each handling a different external concern:
• Persistence (“ddd-hcms-infrastructure-persistence”) contains repository implementations, JDBC components, SQL scripts, and data mapping.
• Cache (“ddd-hcms-infrastructure-cache”), Gateway (“ddd-hcms-infrastructure-gateway”), and Publisher (“ddd-hcms-infrastructure-publisher”) each handle their respective technical responsibilities.
• Launcher – “ddd-hcms-launcher” serves as the bootstrap or startup module which wires the application together (configurations, logging via logback.xml, etc.).
• User Interface Layers – There are multiple UI modules:
• Provider, Subscriber, Web, and Worker modules: Each module (e.g., “ddd-hcms-user-interface-web”) contains controllers, annotations (like UrlRequestParam and its resolver), and configuration classes for presenting a clean API and handling different types of UI or integration tasks.
Relationships and Interactions
• The Infrastructure modules (cache, gateway, persistence, publisher) provide concrete implementations that satisfy the contracts defined in the Domain.
• The User Interface modules expose endpoints (via controllers in, for example, the “ddd-hcms-user-interface-web” module) and interact with the Application Service Layer to process incoming requests or data commands.
• Optionally, indicate interaction with external systems (e.g., databases driven by SQL scripts, external DDD libraries as referenced in the README, or even assets like the book image).
Architectural Patterns and Design Principles
• DDD Patterns: Clearly mark bounded contexts; indicate the separation between the domain, application, and infrastructure layers.
• Layered Architecture: Emphasize the separation of concerns by drawing clear boundaries between modules.
• Repository Pattern: Show how domain repository interfaces are implemented by the persistence layer.
• Command-Query Separation: Note command services vs. query services in the application layer.
• Service Factories: Indicate the factory implementations in both the domain and application layers.