Skip to main content
ARCHITECTUREREACTCFC#react#folder_structure#dxREV 1.0.0

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.

A laptop glowing with vivid orange and blue light on a black desk

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.

Discussion_Thread // 0_Responses