Feature-Sliced Design (FSD) architectural methodology for frontend applications...
Front-end 애플리케이션 코드를 구조화하기 위한 아키텍처 방법론으로, 비즈니스 요구사항 변화에 강하고 기능 추가가 용이한 프로젝트 구조를 제공합니다.
Reference these guidelines when:
| Layer | Purpose | Examples |
|---|---|---|
app |
Application initialization | routing, global styles, providers |
pages |
Route-based page components | /home, /profile, /settings |
widgets |
Large independent UI blocks | Header, Sidebar, Dashboard |
features |
Business value features | AddToCart, UserAuth, CommentForm |
entities |
Business entities | User, Product, Order |
shared |
Reusable utilities | UI kit, helpers, types |
Critical Rule: Upper layers can import from lower layers, but NOT vice versa.
app → pages → widgets → features → entities → shared
(Top) (Bottom)
Within each layer, code is separated by business domain:
features/auth/, features/cart/, features/payment/entities/user/, entities/product/, entities/order/Critical Rule: Slices in the same layer CANNOT import from each other.
Within each slice, code is organized by purpose:
| Segment | Purpose |
|---|---|
ui |
React components, styles |
api |
Backend communication, data fetching |
model |
State management, types, business logic |
lib |
Utility functions |
config |
Configuration, feature flags |
Each slice exports through index.ts:
// features/auth/index.ts
export { LoginForm } from './ui/LoginForm';
export { useAuth } from './model/useAuth';
export type { User } from './model/types';
Rule: Only import from Public API, never from internal files directly.
pages can import from widgets, features, entities, sharedfeatures can import from entities, sharedentities CANNOT import from featuresshared CANNOT import from any other layerfeatures/auth → entities/user)features/auth → features/cart)from '@/features/auth'from '@/features/auth/ui/LoginForm'feature/auth/
├── ui/ # React components
│ └── LoginForm.tsx
├── api/ # API calls
│ └── authApi.ts
├── model/ # State & types
│ ├── useAuth.ts
│ └── types.ts
├── lib/ # Utilities
│ └── validation.ts
└── index.ts # Public API
project/
├── app/ # Next.js routing (file-system based)
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Re-export from @/pages/home
│ └── users/
│ └── page.tsx # Re-export from @/pages/users
│
└── src/ # FSD Architecture
├── app/ # FSD app layer (providers, init)
│ └── providers/
├── pages/ # FSD pages layer (page components)
│ ├── home/
│ │ └── ui/HomePage.tsx
│ └── users/
│ └── ui/UsersPage.tsx
├── widgets/
├── features/
├── entities/
└── shared/
Key Rules:
app/ folder: routing only, re-export from FSD pagessrc/app/: providers, initializationsrc/pages/: actual page components with business logic'use client' when needed