← All patterns
Application 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.

100%

Scroll to pan. Select a component for its role.

layered architecture architectureA logical layered application separates presentation, orchestration, business rules and persistence. Blue arrows are logical calls in this variant. Layers do not imply separate machines.Logical application layersExternal dataclient → presentation: interactionpresentation → application: use caseapplication → domain: business decisiondomain → persistence: logical data accesspersistence → sql: query / writeinteractionuse casebusiness decisionlogical data accessquery / writeThe client reaches the presentation boundary.ClientUser interactionTranslate user interaction into an application request.PresentationControllers / viewsCoordinate an operation and its access to business rules.ApplicationUse-case orchestrationKeep business rules explicit; choose source-dependency boundaries separately.DomainBusiness invariantsThe repository handles data access under the selected architecture policy.PersistenceRepositoryimplementationPersistence is a responsibility; the store is a runtime dependency.Data storeDurable recordsA physical N-tier deployment is a separate choice.Deployment choiceLogical layers can share one application process

Select a component, or focus it and press Enter, to read its role.

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.

PresentationActive in this stepApplicationActive in this stepDomainWaitingPersistenceWaiting
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.

Connect concept to practice

Related challenges

Browse challenges →

These links open the original challenges. Existing round unlocks, completions and points apply.

Keep one responder on duty

Related practice in business invariants. The canvas does not score source-code layers or imports.

Open challenge →

Further reading

Microsoft · N-tier and logical layers ↗

Original PractiseGrid explanations and conceptual diagrams, with primary references for further study. Dedicated scored exercises can be added as coverage grows.