Skip to content

Hexagonal

aka: Ports and Adapters

Hexagonal architecture puts the application core at the center and lets it talk to the outside world only through ports (interfaces). Adapters implement those ports for concrete technologies (REST, database, message bus, ...). The core defines the ports and knows nothing about the adapters, so infrastructure can be swapped or mocked without touching business logic.

  • Driving adapters (UI, tests) call inbound ports.
  • Driven adapters (DB, external services) implement outbound ports.
  • ✅ Core is isolated from infrastructure → easy to test and change.
  • ✅ Technologies can be replaced by writing a new adapter.
  • ❌ More indirection; overkill for simple CRUD (see Lightweight).

Related