The textbook onion, and TheYard's
Pinch or Ctrl+scroll to zoom; the text is selectable.
Source
·
TheYard
Palermo's onion beside TheYard's rings: each textbook ring tied to the project that is that ring, every dependency pointing inward
The textbook onion, and the one this codebase is built as
Four rings on the left, as the pattern is written down. On the right, the projects that are those rings, one deliberate difference: the centre is split in two.
The pattern (Cockburn 2005, Palermo 2008, Martin 2012)
TheYard
Frameworks, drivers, tests
The web framework, the database
engine, the browser.
Interface adapters
Controllers, gateways,
repositories: one real thing each.
Use cases, the application
What the software does with the
rules, and the ports it needs.
Entities, the domain model
The rules that would exist
with no software at all.
Host, front end, tests
api/TheYard.Api, src/, render/, api/TheYard.Tests
Endpoints read a request and ask Auction;
Composition/ wires every service.
The adapters, the same ports twice
api/TheYard.Infrastructure[.Cosmos]
EF Core over Azure SQL or SQLite,
and the Cosmos DB SDK.
The use cases
api/TheYard.Application
Auction, and the ports the auction
and the operator need.
The rules
api/TheYard.Domain
BidRules, AuctionSchedule,
StandingRules, VehicleFilter.
The shapes
api/TheYard.Data
Records with no behaviour.
Dependencies point inward
Dependencies point inward
A dashed line ties a textbook ring to the project that is that ring. Ten tests in api/TheYard.Tests/OnionTests.cs fail the build when a dependency points the other way.
Source: docs/images/onion-side-by-side.svg in the repository, drawn by docs/images/onion-side-by-side.mjs and redrawn when a ring changes.