Organisation at scale.
WHAT TO ORGANISE BY
Feature, rather than by file type.
WHY
Files that change together should sit together. Grouping all components in one folder and all hooks in another separates them.
WHAT A FEATURE FOLDER CONTAINS
Its components Its hooks Its data access Its types
WHAT TO KEEP SHARED
Genuinely reusable components Utilities used across features Design system elements
WHAT TO SEPARATE
Presentational components from data fetching Business logic from components
WHY
Logic inside components cannot be tested or reused independently.
WHAT TO PUT LOGIC IN
Custom hooks, for stateful logic Plain functions, for everything else
WHAT TO AVOID
Very large components Components fetching data and also rendering complex interfaces Deeply nested folder structures
WHAT TO ESTABLISH EARLY
Conventions for naming, structure and where things belong.
WHY
They are difficult to introduce later.
WHAT TO DOCUMENT
Those conventions.