Related to: Hexagonal architecture
In “Building hexagonal architectures on AWS” guide this structure is recommended to organize the code with DDD in mind.
app/ # application code
|--- adapters/ # implementation of the ports defined in the domain
|--- tests/ # adapter unit tests
|--- entrypoints/ # primary adapters, entry points
|--- api/ # api entry point
|--- model/ # api model
|--- tests/ # end to end api tests
|--- domain/ # domain to implement business logic using hexagonal architecture
|--- command_handlers/ # handlers used to run commands on the domain
|--- commands/ # commands on the domain
|--- events/ # events emitted by the domain
|--- exceptions/ # exceptions defined on the domain
|--- model/ # domain model
|--- ports/ # abstractions used for external communication
|--- tests/ # domain tests
infra/ # infrastructure code
Ref: https://docs.aws.amazon.com/prescriptive-guidance/latest/hexagonal-architectures/best-practices.html
I think commands
and command_handlers
can be replaced with the services
as service layer to the domain that can be represented as a collection of functions.