Created
January 25, 2024 12:11
-
-
Save maloufde/09c830901c129981add223f4fbf59b2b to your computer and use it in GitHub Desktop.
Example - Hexagonal Design - Ports and Adapters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hexagonal Design
This is an example for a structured monolith (or sometimes called modulith) to decouple adapters and framework from
the domain via contracts.
Domain (dark blue)
May be divided into several subdomains and/or shared domains. In a monolith, each domain may also be separated into
the api and the internal logic and model, invisible for other subdomains. This enables to tear the monolith apart into
several microservices if appropriate.
Ports (Yellow)
As in real life, you can't walk always alone. You need help and food - but you don't want to be dependent from a
single supermarket. So you choose an abstraction and name it, e.g. Object Store, Feature Toggle,
Configuration, Template Engine, User Directory etc. These are visualized by the round Ports,
representing consumer contracts you are willing to fulfill (magenta), or you expect some other components to fulfill (light-blue).
Adapters, Frameworks and Dependencies (White / Green)
For Unit Testing you just need the Domain, the Ports and some test doubles.
For production, the Adapters (white) are components to adapt the application needs to the
surrounding service landscape.
Tips: