View Source on Github

Hexagonal Architecture

Difficulty-Expert Java Architectural

Also known as

  • Ports and Adapters
  • Clean Architecture
  • Onion Architecture


Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.

Hexagonal Architecture class diagram


Use Hexagonal Architecture pattern when

  • When the application needs to be independent of any frameworks
  • When it is important that the application highly maintainable and fully testable



Real world examples

  • Apache Isis builds generic UI and REST API directly from the underlying domain objects