Hexagonal architecture implementation following clea architecture principles
- The project is a typical ecommerce order-product application
- Application architecture can be seen below:
- Modules:
- rest-adapter:
- Spring based REST controllers that expose API to perform e-commerce related operations
- persistence-adapter:
- Spring based JPA entities that govern persistence model and repositories to interact with database
- service:
- Mediator between adapters and domain exposing ports to various adapters and internally interacting with domain layer
- domain:
- Vanilla Java that contains core entity business logic
- application:
- Glue that configures all the service dependencies together
- rest-adapter:
- Design Decisions:
- One-Way model mapping strategy has been followed where:
- Adapters have their own model
- Ports and Domain share the same model:
- Adapting two-way approach leads to convoluted objects
- Further, increases maintenance of the application
- In a large scale system, can become complex very quickly to manage state of various objects
- One-Way model mapping strategy has been followed where:
- API: http://localhost:/swagger-ui/index.html