Hexagonal Architecture: Structuring a project and the influence of granularity

About the granularity of ports and adapters and how it influences the code structure

Anton Stöckl
12 min readMay 20, 2022

I did a major update of this article (3rd of June, 2022) after it was first published

Motivation / Is this article for you?

Hexagonal Architecture as an architectural pattern is not overly complex. Still, I remember that I spent some time finding out “where to put things” in the past.

If you are not yet familiar with Hexagonal Architecture you should read Alistair Cockburn’s original article! It will also explain the terminology used in the following!

If you want to dive deep into the details I can only recommend reading the great articles on the website of Juan Manuel Garrido de Paz.

Thomas Pierrain also wrote a lot of interesting content about the topic.

Alistair tweeted a while ago:

After re-reading the article I had to conclude that “everything is there”. But I have engaged myself a lot in the topic since then, so I guess I learned something about it. Also, how can I tell…

--

--

Anton Stöckl

Domain-Driven Design, Hexagonal Architecture (aka. Ports&Adapters), Go, Elixir, Event-Sourcing & CQRS, Learning Designer for Software Developers @ MaibornWolff