Hexagonal pattern (architecture)

Introduction

The hexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level and facilitates test automation.

Hexagonal architecture (pattern)

The software system should be divided to decoupled parts mainly: user interface, core business logic, server/database. These layers are connected with each other through different Ports/Adapters.

The Ports are interfaces that offer functionalities. Adapters are users of these functionalities.


The hexagonal architecture divides a system into several loosely-coupled interchangeable components, such as the application core, the database, the user interface, test scripts and interfaces with other systems. This approach is an alternative to the traditional layered architecture. Basically, the one can define ports for databases, logging, event sourcing, notifications etc. There can be multiple Adapters that call same port.