Project structure affects scalability, maintainability, and development speed.
System design context: As a React codebase grows from 10 to 1000+ components, the folder structure determines how easily developers can find code, understand dependencies, and add features. A poor structure leads to circular imports, merge conflicts, and cognitive overload. The goal is to group code by what it does, not what it is.
1. Feature-Sliced Design (FSD) — recommended approach:
src/
app/ # router, store, global styles, layout
pages/ # pages (routes)
widgets/ # large blocks (Header, Sidebar, Footer)
features/ # business logic (auth, cart, search)
entities/ # entities (User, Product, Order)
shared/ # reusable components, utilities, API
Why FSD works: Each layer has strict rules about what it can import from lower layers. This prevents circular dependencies and makes refactoring safe. features/ never imports from pages/, and shared/ never imports from features/.
2. Colo-oriented structure (legacy approach):
src/
components/ # all components
hooks/ # all hooks
utils/ # utilities
services/ # API layer
types/ # TypeScript types
assets/ # images, fonts
3. File naming:
components/
UserCard/
UserCard.tsx # component
UserCard.test.tsx # test
UserCard.stories.tsx # Storybook
index.ts # export
4. Import rules:
1// Use path aliases (@/)2import { Button } from "@/shared/ui/Button";3import { useAuth } from "@/features/auth";4import type { User } from "@/entities/user";
Scaling patterns for large teams:
index.ts) for clean public APIs.shared/ truly generic — if it references a domain entity, it belongs in entities/.5. Other best practices: