"매 file layout 의 의 architecture 의 — folder 의 dependency direction 의 enforce". 2026 의 의 매 dominant convention 의 Feature-Sliced Design (FSD) + colocation by route (Next.js App Router). 매 monorepo 의 의 매 cross-package boundary 의 의 nx/turbo 의 의 enforce.
매 핵심
매 layered approach (FSD)
app: 의 entrypoint, provider, router setup.
pages / routes: 의 page-level composition.
widgets: 의 self-contained UI block (Header, Sidebar).
features: 의 user action (LoginForm, AddToCart).
entities: 의 domain object (User, Product).
shared: 의 reusable utility (UI kit, lib, config).
매 dependency 의 down-only — 의 widget 의 entity/shared 의 import 의 OK, 의 reverse 의 X.
매 colocation 의 rule
의 component 의 의 close 의 의 use site.
의 test, story, type 의 의 same folder.
Route folder 의 의 page-only 의 keep — 의 reusable 의 의 lift up.
매 응용
Solo project 의 의 minimal (src/components, src/pages).
// features/auth-login/index.ts
export{LoginForm}from"./ui/LoginForm";export{useLogin}from"./model/use-login";// 매 internal helper 의 의 of export 의 X — barrier.
// widgets/header/Header.tsx
import{LoginForm}from"@/features/auth-login";// OK — public API
// import { internalHelper } from "@/features/auth-login/lib/internal"; // X
// 매 export * 의 의 tree-shaking 의 hurt 의 가능
export*from"./Button";export*from"./Card";// 매 explicit re-export 의 더 의 safe
export{Button}from"./Button";export{Card}from"./Card";
매 결정 기준
상황
Approach
Solo / prototype
src/{components,pages,lib} flat
Team < 5, single app
FSD-lite (skip entities, merge widgets)
Team > 5
Full FSD + ESLint boundaries
Multi-app
Monorepo (turbo / nx) + shared packages/ui
Next.js App Router
Route colocation + _private folders
기본값: FSD-lite (app/pages/features/shared) + path alias + ESLint boundaries.