Onion vs Clean vs Hexagonal Architecture

Eric Damtoft
3 min readNov 30, 2021
Photo by mayu ken on Unsplash

Clean Architecture, Hexagonal Architecture, and Onion architecture all circle around fundamentally the same concept, but with different language and nuances. We’ll take a look at what makes them similar and different.

As background, all share the concept of externalizing infrastructural details, data storage, and user interface and pushing them to the edges of your application as opposed to building your application around those pieces.

In this video, I explain the core principals of the pattern:

Ports and Adapters

The most bare bones application of the principal is Hexagonal or “ports and adapters” architecture. The concept was introduced by Alistair Cockburn in 2005 in this post. Confusingly, the pattern really has nothing to do with hexagons, it’s just how it’s usually drawn. The fact that it has 6 sides is arbitrary.

The concept behind Hexagonal Architecture is that your core application logic is written with only a concept of whatever external dependencies it has. In object-oriented terms this…

--

--