Hexagonal Architecture

  • 20 September 2023
  • 4 replies

Why is there a "hexagon"? Why the 6 sides? And how important is it?

4 replies

Userlevel 5
Badge +3

It was invented by a guy named “Alistair Cockburn” funnily enough :cD

Userlevel 5
Badge +3

Honestly, I’d say that you should probably ask a guy named Alistair Cockburn for the answer. :)

The “hexagon” in this case is not to represent the six slides (in fact, it could have been the octagone as well), but having a hexagon instead of a square allows the people to draw the ports and adapters as they need. No longer are they limited to one-dimensional drawings, as the adapters and ports can be drawn under the angle.

A hexagon because it wants to break with the classic asymmetric drawing of a rectangle, where the flow goes "top to bottom" or "left to right". On the other hand, the hexagon remarks the symmetry on all sides, i.e. it highlights the inside/outside distinction, instead of the top/bottom or the left/right. The chosen polygon was a hexagon because it is easier to draw than others (pentagon, heptagon, ...)

The number of sides (6) isn't important, the important thing is what a side means. Each side represents a "port", which is define by the inside (the app) for interacting with the outside. Ports protect our app from the rest of the world.


The hexagon itself is not important in hexagonal architecture. What is important is the ports and adapters, which form nice interfaces to the business logic, and like Lego bricks can be connected to create different structures. The hexagon is simply a way of communicating the architecture.