Skip to content

Layered Architecture

Layered architecture is a design pattern that organizes code into well-defined layers, each with a specific responsibility.

  1. Presentation (UI)

    • React components
    • UI hooks
    • Styles and layouts
  2. Business Logic

    • Use cases
    • Business rules
    • Data transformation
  3. Data

    • API services
    • Repositories
    • State management
src/
├── app/ # App shell (router, providers)
├── features/ # Feature-specific logic
│ ├── cart/ # Shopping cart
│ └── product/ # Product catalog
├── entities/ # Entities and services
│ └── product/ # Product service
└── shared/ # Shared components and utilities

In the following sections, we will implement a practical example of an online store using layered architecture.