Worked example — sketching the hexagon in PlantUML.
PlantUML is a tiny text DSL: every diagram starts with @startuml and ends with @enduml. Inside, package groups related things and interface / class declare types. An arrow ..> means depends on:
@startuml
package "domain" {
interface OrderRepository
class Order
}
package "infrastructure" {
class PostgresOrderRepository
}
PostgresOrderRepository ..|> OrderRepository : implements
PostgresOrderRepository ..> Order : uses
@enduml
The two rules you must keep visible in your diagram:
- The interface lives in
domain, not in infrastructure. That's the port — owned by the high-level policy.
- Every arrow crosses from
infrastructure into domain, never the other way. If you ever need an arrow pointing out of domain, your hexagon is broken.