Skip to content
Mermaid templates

Hexagonal Architecture (Ports & Adapters)

Domain core surrounded by ports + adapters for I/O.

Template previewMermaid
Rendering…

Make it your own.

flowchart LR
HTTP[HTTP adapter] --> P1[Inbound port:\nuse cases]
CLI[CLI adapter] --> P1
P1 --> Domain((Domain core\nentities + services))
Domain --> P2[Outbound port:\nrepository]
Domain --> P3[Outbound port:\nemail]
P2 --> PG[(Postgres adapter)]
P2 --> Mem[(In-memory adapter — tests)]
P3 --> SMTP[SMTP adapter]
P3 --> Console[Console adapter — tests]
classDef adapter fill:#dbeafe,stroke:#1e3a8a;
classDef port fill:#fef3c7,stroke:#92400e;
class HTTP,CLI,PG,Mem,SMTP,Console adapter
class P1,P2,P3 port