TheYard's rings

Pinch or Ctrl+scroll to zoom; the text is selectable. Source · TheYard

TheYard's rings: Data at the centre, then Domain, then Application, with the host and the adapters outside, every dependency pointing inward TheYard's rings: every dependency points inward Each box is a ring. The inner three are one project each; the outer one holds the host and both adapters. A ring may use the rings inside it and never one outside it. Outside: the host and the adapters api/TheYard.Api The host reads a request, asks Application and writes the answer (Endpoints/); Composition/ wires it all. The adapters implement the ports: EF Core over Azure SQL Database or SQLite, and the Cosmos DB SDK. api/TheYard.Infrastructure api/TheYard.Infrastructure.Cosmos YardUser only Application: the use cases and the ports api/TheYard.Application Auction composes a store's catalogue, bids and room in the order the rules need. It owns the ports: IVehicleSource, IPhotoManifestSource, IBidStore, IActivityStore and the rest. Domain: the rules api/TheYard.Domain BidRules, AuctionSchedule, AuctionClock, StandingRules, VehicleFilter, VehicleOrdering, VehicleSearchIndex, PhotoGallery and the Fnv1a hash the schedule is derived from. Pure functions of their inputs and the clock they are handed. No store, no web, no clock of its own. Data: the dataset's shapes api/TheYard.Data Vehicle and PhotoEntry, exactly as data/vehicles.json has them. No behaviour and no dependencies: every ring may read it, and it reads nothing. uses uses uses Held by the gate api/TheYard.Tests/OnionTests.cs (NetArchTest) Data_depends_on_nothing_outside_the_BCL Domain_depends_on_nothing_outside_the_BCL_and_Data Domain_never_reaches_the_disk_the_network_ or_the_clock Application_depends_only_on_Domain_Data_and_the_BCL Application_never_reaches_the_disk_or_the_network The_document_store_adapter_borrows_only_ the_shared_user_from_the_relational_one Endpoints_never_reach_a_store_or_ the_service_container Endpoints_reach_the_auction_only_through_ the_Application_ring The_host_never_queries_a_database_itself Services_are_registered_only_in_the_composition_root Each one reads the compiled assemblies, so a reference in a method body, a generic argument or a fully written name fails the gate the same way a using line would. A failure names the type and the dependency it found. Beside the onion, and outside these rules: TheYard.Database (the SQL schema), the SQLite migrations, the Experiment console and the tests. The front end keeps the same shape in src/: components use hooks, hooks use lib, and src/lib imports nothing from React. Source: docs/images/rings.svg in the repository, drawn by docs/images/rings.mjs and redrawn when a ring changes.