Most engineers have seen the clean architecture picture: four colored rings with arrows pointing at the middle. Far fewer can say what goes into each ring for a real feature, which way the imports should point, or where the SQL lives.
The gap shows up in code review: a domain folder that imports the ORM, a use case that returns an HTTP status code, five mappers between a form and a table.
This post turns Robert C. Martin's circles into a component diagram for one use case, placing an order: the layers, the dependency rule, code and folders, boundary crossings, clean versus hexagonal and onion, mistakes, when it is overkill, and how to draw it.
The four layers
Martin described the clean architecture in a 2012 blog post, The Clean Architecture , and expanded it in his 2017 book Clean Architecture . He presented it as an integration of earlier ideas, including hexagonal and onion architecture.…