Platform
    • FSD Layers
    • Entity Structure
Projects
  • API Connections & Tools
  1. Documentation
  2. Architecture (FSD)

Feature-Sliced Design Rules

Establishing a strict hierarchy of layers and dependency boundaries to ensure horizontal and vertical decoupling.

Architecture Standard

The FSD methodology allows creating scalable and predictable applications by dividing code into functional layers with clear isolation of responsibility.

01Mental Hierarchy

Dependency flow is always downward: upper layers use lower ones, but never vice versa.

app
Can use ↓
pages
Can use ↓
widgets
Can use ↓
features
Can use ↓
entities
Can use ↓
shared
Foundation

02Dependency Boundaries

Each layer has clearly defined import permissions.

entities
accesses:
shared
features
accesses:
entities
shared
features
widgets
accesses:
features
entities
shared
pages
accesses:
widgets
features
entities
shared
app
accesses:
pages
widgets
features
entities
shared

03Standard Entity Structure

Each entity is a self-contained module. We use strict subfolder separation for predictability and maintainability.

Available Modules

  • api/: API definitions (RTK Query).
  • converters/: Data mappers (DTO <-> Domain).
  • handlers/: MSW mock handlers.
  • mock/: Static fixtures and mocks.
  • schema/: Zod validation schemas.
  • slice/: Redux state management.
  • ui/: Presentation components.
  • types/: Interfaces and types.
  • index.ts: Module entry point.

04Widget: Model & UI Separation

Widgets are "smart" blocks. We separate logic (model) from the visual part (ui) to simplify testing and refactoring.

Why it's important

The model/ folder contains everything that makes the widget functional (Zod schemas, form configs, local types). The ui/ folder contains only display components.

05Practical Examples

✅ Correct
src/features/auth/ui/login-form.tsx
1import { useAuthStore } from "@/entities/session"; // OK: feature -> entity 2import { Button } from "@/shared/ui"; // OK: feature -> shared
❌ Violation
src/entities/user/model/user.ts
1import { logoutFeature } from "@/features/auth"; // ERROR: entity -> feature (LAYER VIOLATION)

06Global Settings

Cross-layer Imports
Enforced
Directory structure
Enforced
Private Imports
Enforced
Barrel Exports
Enforced