All glossary terms
Design

Onion architecture

Onion architecture organises code in concentric layers from the domain model at the centre outward through application services, domain services, and infrastructure at the edge. Dependencies point inward only — infrastructure depends on application; application depends on domain; domain depends on nothing. The pattern enforces dependency inversion through structure.

Jeffrey Palermo introduced onion architecture around 2008. It's closely related to hexagonal and clean architecture — all three enforce inward dependency through the same mechanism. The differences are presentational: onion emphasises the concentric-circle visualisation; hexagonal emphasises ports and adapters; clean emphasises layers explicitly. In practice teams pick one vocabulary and stick with it. The benefit is uniformity: a new engineer can find the domain logic (centre), the application services (next ring), and the database code (outer ring) by structure alone, without reading every file.

Related terms