Hexagonal Architecture

 Hexagonal architecture is a model of designing software applications around domain logic to isolate it from external factors.

The domain logic is specified in a business core, which we’ll call the inside part, with the rest being outside parts. Access to domain logic from the outside is available through ports and adapters

here we divide our application into three layers: application (outside), domain (inside), and infrastructure (outside):

DDD Layers

Through the application layer, the user or any other program interacts with the application. This area should contain things like user interfaces, RESTful controllers, and JSON serialization libraries. It includes anything that exposes entry to our application, and orchestrates the execution of domain logic.

In the domain layer, we keep the code that touches and implements business logic. This is the core of our application. This layer should be isolated from both the application part and infrastructure part. In addition, it should also contain interfaces that define the API to communicate with external parts, like the database, which the domain interacts with.

Finally, the infrastructure layer is the part that contains anything that the application needs to work, such as database configuration or Spring configuration. It also implements infrastructure-dependent interfaces from the domain layer.


The domain part only contains business logic, and can be easily moved to a different environment.


Hexagonal Architecture, DDD, and Spring | Baeldung


What is the difference between the Hexagonal Architecture and domain driven design:s

Hexagonal Architecture and Domain-Driven Design (DDD) are distinct concepts in software development, though they can often be used together. DDD focuses on modeling and understanding the business domain, while Hexagonal Architecture provides a way to structure your application to promote testability and decoupling. 


Hexagonal Architecture – System Design | GeeksforGeeks




Comments

Popular posts from this blog

Archunit test

visitor design pattern

Observer design pattern