Skip to content

Ports and Adapters

Spicy — senior dev territoryArchitecture

ELI5 — The Vibe Check

Ports and Adapters (aka Hexagonal Architecture) means your app defines 'ports' (interfaces) and the outside world connects through 'adapters.' Want to switch from PostgreSQL to MongoDB? Just swap the adapter. The app's core never changes.

Real Talk

An architectural pattern (by Alistair Cockburn) where the application core defines ports (interfaces) that adapters implement. Driving adapters (e.g., REST controllers, CLI) initiate actions, while driven adapters (e.g., database repositories, email services) are called by the core. This creates a technology-agnostic core that's easily testable.

When You'll Hear This

"The repository port is an interface — the PostgreSQL adapter implements it for production, the in-memory adapter for tests." / "Ports and adapters make your app testable without any infrastructure running."

Made with passive-aggressive love by manoga.digital. Powered by Claude.