← All patternsApplication structure · Architecture pattern
Layered architecture
Give presentation, application, domain and persistence distinct responsibilities.
The problem
A UI handler mixes formatting, reservation rules and database queries, so a small change touches every concern.
When it fits
A team benefits from predictable responsibility boundaries and an explicit policy for cross-layer calls.
The whole architecture
Architecture diagram
A logical layered application separates presentation, orchestration, business rules and persistence.
Blue arrows are logical calls in this variant. Layers do not imply separate machines.
Scroll to pan. Select a component for its role.
API / data call
Select a component, or focus it and press Enter, to read its role.
This simple logical-call view does not prescribe concrete infrastructure imports in domain code.
The Clean/Hexagonal/Onion diagram separately illustrates dependency inversion.
Walk through the design
Follow one operation
Select a step to highlight its participants. This conceptual walkthrough is separate from challenge scoring.
Arrows illustrate logical calls in a simple layered variant. Source dependencies can be inverted through interfaces.
Step 1 of 3
Translate the interaction
Presentation converts a user action into an application request.
Trade-offs to make explicit
Layers organize code; physical deployment tiers are a separate decision. A layered application can run in one process.
Strict layers make allowed calls predictable but can introduce pass-through work. Dependency inversion can protect domain rules from persistence details.
Failure modes to plan for
A shortcut from presentation to persistence can bypass authorization or business rules.
A domain module that imports an ORM can require infrastructure just to test a business decision.
Before you build
Explain your decision
Which layer owns each rule, and which dependencies should a build-time boundary check reject?
Use Plan & estimate inside practice to record your assumptions and trade-offs.
Original PractiseGrid explanations and conceptual diagrams, with primary references for further study. Dedicated scored exercises can be added as coverage grows.