9 min readCalm pace · scan the outline anytime

Golden flow

Ordered path of one request — UI to Use Case to Domain port to adapter and back.

Golden flow

Purpose: show the exact ordered path of one request inside a single module (e.g. Ordering placing an order).

The compact “cycle” diagram often confuses readers by mixing descent and ascent. Below they are separated, then a sequence shows time order.

1. Request descent (inward)

StepComponentResponsibilityMust not
1ControllerPick Use Case, map input → DTO, map result → responseContain eligibility / reservation / peer rules
1Input validationValidate format (types, required, max length)Encode business policy
2Application DTOTyped carrier of UI inputKnow ORM or HTTP transport details
2Use CaseOrchestrate the feature (__invoke)Call ORM directly, facades, or foreign *ModuleInterface
3Entity / Domain serviceBusiness meaning and invariantsImport host framework or other modules
3Port interfaceDeclare I/O in Domain languageMention ORM class names
4AdapterTalk to DB / peer / HTTP; map to Domain typesLeak ORM models back to the Use Case

2. Response ascent (outward)

DirectionAllowed types
Infrastructure → ApplicationDomain Entity, Domain DTO, scalars — never ORM models
Application → UISame Domain result (or a small Application result object)
UI → ClientResource / array / response envelope only

3. Full lifecycle sequence

Ordering “place order” mapping

Sequence stepConcrete class (illustrative)
ValidationPlaceOrderRequest (or equivalent)
Application DTOPlaceOrderDTO + line DTOs
Use CasePlaceOrderUseCase
Nested helperPrepareOrderLines (not called by UI)
PortsOrderRepositoryInterface, WarehouseAvailabilityPortInterface
AdaptersPersistence repository, WarehouseAvailabilityAclAdapter

Delivery wording

UI adapter (controller, request handler, admin action, console command) validates input shape, builds an Application DTO, invokes the Use Case, then maps the Domain result to a response.

Illustrative host mappings — not Core MUST

UI delivery (authorize → Application DTO → Use Case → present)

HostTypical place
LaravelControllers + Form Requests; optional Filament under `UI/Filament/`
SymfonyControllers; API Platform as UI adapter if used
YiiControllers / actions as UI adapters
CodeIgniterControllers + validation as UI adapters
CakePHPControllers + Form helpers as UI adapters
SpiralControllers / prototypes as UI adapters
SlimRoute callables / Action classes (PSR-7/15)
MezzioPSR-15 request handlers / middleware

Full topic pages: Adapters overview

Common mistakes

MistakeFix
Controller calls repository / ORM directlyController → Use Case only
Use Case creates / queries ORM records directlyInject OrderRepositoryInterface
Validation layer invokes Use CaseController invokes Use Case
Repository returns ORM models to Use CaseMap to Entity in Infrastructure
Peer module’s controller calls this Use CasePeer uses ACL or Events only

Checklist before merge

  • One first-level Use Case is the only entry from UI for this action
  • Application DTO is the only input type into __invoke
  • All I/O goes through Domain ports
  • No ORM types in Application / Domain
  • Response mapping stays in UI

Next: use cases & DTOs · ports & persistence.

Modular Hexagonal Domain-Driven Design
Core 1.0.0-draft