Replies: 1 comment
-
|
I think this is the same discussion: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hexagonal Architecture in jmolecules
When using a hexagonal architecture, we usually default to the following structure:
But when I look at the jmolecules annotations for hexagonal architecture, there is no annotation for the domain 'layer'. Currently, only the following annotations are available:
@Application@Port(Primary/Secondary)@Adapter(Primary/Secondary)This leaves it unclear how to strictly separate the domain from the application/use-case layer and enforce or document intended dependency direction (e.g., the domain must not depend on the application/use-case code).
Expected structure (logical dependencies):
Expanded Explanation (you can feel the AI shine through 🫣, sorry about that)
Layering Explained:
Domain:
Contains the business logic and domain model. Should be fully independent, without references to applications, ports, or adapters.
Note: There is currently no
@Domainannotation in jmolecules; the domain layer is defined only by convention (e.g.,core/domain/).Application (Use-Case):
Orchestrates use-case logic and is annotated with
@Application. May depend on the domain model and ports, but never the other way around.Ports:
Interfaces that define contracts for communication between core/application and external systems. Annotated with
@Port(Primary or Secondary).Adapters:
Implement external interactions, annotated with
@Adapter(Primary or Secondary).Dependency Direction:
Recommended Dependency Table
Best Practices with jmolecules
@Domainannotation.@Applicationfor orchestration/use-case classes.@Portfor interfaces in the ports package.@Adapterfor adapter implementations.Open questions:
@Domainannotation help clarify these boundaries?Feedback and suggestions for improving this layering and annotation support are welcome!
Beta Was this translation helpful? Give feedback.
All reactions