The Centralized File-Component Pattern
Keep everything a component needs — structure, logic, styling, tests and stories — in one cohesive folder. A pragmatic take on React project structure.
Why CFC
Scattered atoms, hooks, and styles make refactors expensive. The Centralized File-Component pattern colocates the public API, styles, tests, and stories so every component ships as a unit.
Folder shape
Each component lives in its own directory: Component.tsx, Component.module.scss, Component.stories.tsx, Component.test.tsx, and index.ts. Sections and features follow the same contract at larger granularity.
Storybook + tests
Storybook becomes the visual contract; Vitest guards behavior. Consumers import from package roots — never deep paths — so moves stay internal.
