Feature-Sliced Design (FSD) is a code organization methodology in React projects that divides everything into layers and modules by functionality.
Simple analogy: Imagine you are building a house.
- Without FSD — all materials are piled in one heap: bricks, wiring, pipes, windows — everything is mixed.
- With FSD — each part of the building has its place: foundation (shared), frame (entities), rooms (features), layout (pages).
FSD layers (top to bottom):
- App — application setup (router, global styles, store).
- Pages — pages (home page, user page).
- Widgets — independent blocks (header, sidebar, footer).
- Features — features (registration, search, cart).
- Entities — entities (User, Product, Order).
- Shared — common (UI components, utilities, API).
Rules:
- Upper layer can use lower, but not vice versa.
- Features cannot import from Widgets.
- Shared can be used by all.
Advantages:
- Loose coupling — changes in one feature do not break others.
- Logic isolation — easier to remove/replace a feature.
- Reusability — entities and shared can be reused between projects.
- Scalability — teams can work on different features independently.
Example structure:
src/
app/ # router, store, global styles
pages/ # ProfilePage, SettingsPage
widgets/ # Header, Sidebar, Footer
features/ # auth (login, register), cart (add, remove)
entities/ # User, Product, Order
shared/ # Button, Input, api, helpers