Establishing a strict hierarchy of layers and dependency boundaries to ensure horizontal and vertical decoupling.
Each entity is a self-contained module. We use strict subfolder separation for predictability and maintainability.
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.
1import { useAuthStore } from "@/entities/session"; // OK: feature -> entity
2import { Button } from "@/shared/ui"; // OK: feature -> shared1import { logoutFeature } from "@/features/auth"; // ERROR: entity -> feature (LAYER VIOLATION)