SOLID & Design Patterns Interview Question #103

What is Onion Architecture?

Architectural Patterns, Application Boundaries & Distributed Design Patterns Senior Advanced

Quick Interview Answer

Onion Architecture places the domain model at the center and arranges application and infrastructure concerns in surrounding layers. Dependencies point inward, so outer technical details depend on inner abstractions.

Detailed Explanation

Onion Architecture places the domain model at the center and arranges application and infrastructure concerns in surrounding layers. Dependencies point inward, so outer technical details depend on inner abstractions.

It shares many goals with Clean and Hexagonal Architecture. The main value is protecting domain and application logic from direct dependence on infrastructure technology.

Code Example

[ Web / Infrastructure ]
        |
[ Application Services ]
        |
[     Domain Core     ]