5 min readCalm pace · scan the outline anytime

Decision tree

Choose local Golden Flow, repository port, sync ACL, Domain Event, or Shared promotion.

Decision tree

Purpose: pick the correct path before writing code.

Master flowchart

Decision table

QuestionIf yes →Docs
Only this module’s data and rules?Golden Flow + optional repository portGolden flow, Ports
Need peer data/validation before continuing?Sync ACLACL, Transactions
Peer should react after we finish (no return needed)?Domain EventEvents, Delivery
Multi-step cross-module with compensations?Orchestration (saga-lite)Orchestration
Cross-context list/dashboard?Projection or ACL read — not ORM joinsReads
Same technical helper already needed by a second module?Promote to SharedShared kernel
Same business concept needed by a second module?ACL / Events — never SharedACL
Evolving a façade or event?Treat as published contractContracts

Illustrative examples

FeatureBridgeWhy
Create Ordering draftLocal + repositoryNo peer required for core write
Ordering checks stockACL to WarehouseNeed availability now
Ordering validates member tierACL to DirectoryNeed eligibility now
After fulfilled, finalize stockEvent to WarehouseSide effect after success
Transaction wrapper used by many modulesShared portTechnical, multi-module

Implementation order (practical)

  1. Write the Use Case + Application DTO for the owning module.
  2. If I/O needed → add port + fake/in-memory in tests, then persistence adapter.
  3. If peer needed sync → add local ACL port first (Use Case compiles), then adapter.
  4. If peer needed async → define Domain event payload, dispatch via Shared dispatcher, write consumer listener + inbound Use Case.
  5. For events: add eventId + idempotent consumer handling.
  6. Run architecture boundary tests and feature tests on the host.

Next: anti-patterns · cookbook.

Modular Hexagonal Domain-Driven Design
Core 1.0.0-draft