Hexagonal / Ports-and-Adapters

The Hexagonal Architecture, or Ports-and-Adapters, keeps your core logic at the centre and connects it to the outside world with plug-in adapters. It means your business rules stay pure, no matter how technology changes around them.

Imagine a power strip. You can plug in your phone, laptop, or lamp—each device uses a different adapter, but the power strip never changes. This flexibility lets you swap technologies without rewriting your main logic.

  • Core logic: The central rules, untouched by outside concerns
  • Ports: Clear entry/exit points for communication
  • Adapters: Plug-in connectors for databases, APIs, or user interfaces
A central hub with various cables plugged in using different adapters
Hexagonal architecture lets you swap technology like changing adapters, keeping your core safe and stable.
Hexagonal / Ports-and-Adapters | SimplyAdvanced.dev