Skip to content
Latchkey

What Are Ports and Adapters?

In the ports and adapters pattern, a port is an interface the application core declares to express what it needs or offers, and an adapter is a concrete implementation that connects that port to a real system. Inbound adapters drive the application, while outbound adapters let it reach databases or services. The core depends only on ports, never on adapters.

Why it matters

This separation lets you test the core against fake adapters and switch real ones without rewriting logic. It is the structural mechanism behind hexagonal architecture.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →