Hexagonal architecture (Ports and Adapters)

Keep the application core independent of UI, databases and external services by talking through ports and adapters.

Alistair Cockburn's ports-and-adapters style places business logic at the centre and defines ports (interfaces) for everything it needs or offers; adapters implement those ports for specific technologies. This makes the core testable without infrastructure and lets you swap databases or delivery mechanisms. It adds indirection that small apps may not need.

Type
Architecture pattern
Category
Architecture
Maintainer
Alistair Cockburn (originator)
First released
2005
License
Free
Pricing
Free
Level
Intermediate
Technologies
architecture, testing, ddd
Last verified
26 Nov 2026

What Hexagonal architecture (Ports and Adapters) is used for

  • Long-lived business applications
  • Testing core logic in isolation

Strengths

  • Testability
  • Technology independence

Limitations

  • Extra interfaces and boilerplate

Hexagonal architecture (Ports and Adapters) alternatives

Built with the same technologies

Official links

Sources

Explore