onion architecture
compound.compound. a way of designing computer software where the most important code is in the middle, and other parts are added in layers around it. This keeps the main logic clean because the inner layers do not depend on the outer ones.
compound. A software architectural pattern that organises code into concentric layers, where dependencies only point inward toward the core domain logic. This ensures that the business logic remains independent of external concerns like databases, frameworks, or user interfaces.
We used onion architecture to keep our business logic separate from the database.
By adopting onion architecture, the team ensured that they could swap their database provider without changing any of the core application rules.
The primary benefit of onion architecture is the decoupling of the application core from infrastructure concerns, facilitating easier unit testing and long-term maintenance through strict dependency inversion.
Coined by Jeffrey Palermo in 2008, the term employs the vegetable as a metaphor for concentric layers of dependency.
Etymology adapted from Wiktionary, available under CC BY-SA 4.0.
Typically used in the singular as a proper or common noun to describe a specific design philosophy.
Last updated July 22, 2026