How wikibook/clean-architecture works
Project type and purpose
• This is a Java Spring Boot web application demonstrating a domain-centric “Hexagonal” (Ports & Adapters) architecture.
• Its focus is on account management: querying balances and transferring money.
File structure
• Top-level: build files (Gradle), single module, Spring Boot entry point (BuckPalApplication).
• src/main/java/io/reflectoring/buckpal:
• BuckPalConfiguration / Properties – Spring Boot config
• account/application/port/in & /out – primary/secondary ports (UseCase interfaces)
• account/application/service – use-case implementations (business logic)
• account/domain – core entities (Account, Activity, ActivityWindow, Money)
• account/adapter/in/web – inbound adapter (SendMoneyController)
• account/adapter/out/persistence – outbound adapter (AccountPersistenceAdapter using JPA + Spring Data)
• Tests validate hexagonal rules, system behavior, unit tests for each layer.
Key insights from README
• The architecture style is explicitly Hexagonal (Ports & Adapters).
• Core separation: Domain → Application → Adapters (inbound & outbound).
Elements
• Clear labels for layers/components: Domain, Application Ports, Inbound Adapter, Outbound Adapter, Infrastructure
• From Controller → Input Port → Service → Output Port → Persistence Adapter → Repository → Database
• Return flows for query operations (GetAccountBalanceQuery)
• Interfaces (ports) vs. implementations (adapters).