Outbound ports
Surface the hexagonal seam between the core and its adapters.
In hexagonal / ports & adapters, the application core depends on an interface
(the port) and an adapter implements it. A plain call graph resolves that
interface straight through to the adapter, so the seam disappears. Enable
ShowPorts to draw it back in.
av, _ := archview.New(archview.Options{ ShowPorts: true })What you get
An interface implemented by a repository-layer adapter becomes a port
node, placed in its own column between service and repository:
service ──uses──▶ OrderRepository (port) ◀──implements── postgres adapter- The service → port edge (solid) is the use: the core calls the port.
- The adapter → port edge (dashed) is the implementation, drawn pointing into the port — both arrows converge, the way dependency inversion runs.
- The direct
service → repositoryedge is removed; the port now mediates it.
A port node carries the interface's own file:line, so clicking it opens the
interface definition in your editor.
How a port is recognized
archview considers an interface an outbound port when it is:
- declared in your module, and
- implemented by a project concrete type whose package classifies as the
repository layer (
postgres,gateway,store, …).
Inbound ports (a service interface called by a controller) are intentionally
left as a normal call edge for now — ShowPorts is about the outbound seam.
One use case can fan out to several ports — e.g. a service that writes through
a Repository and also notifies through a Notifier gateway shows both.
See it live in the hexagonal example.