03-app-structure/04-feature-folders.md
Feature folders
Feature folders
Vroq apps should group most app behavior by feature.
A feature folder owns a coherent slice of functionality and should keep related UI, state, and API code together.
Why feature folders matter
Feature folders make it easier to:
- find the code that owns a behavior
- keep reducers, actions, and UI aligned
- debug one feature without searching the whole app
- refactor large features into smaller parts
Standard feature layout
A feature folder will often look like this:
features/featureName/
index.js
featureActions.js
featureReducer.js
FeatureSection.js
apiClient.js
components/
sections/
Not every feature needs every file. Only create files that have a clear responsibility.
Typical file roles
index.js– exports the public feature entry pointsfeatureActions.js– action creators for the featurefeatureReducer.js– reducer for the feature state sliceFeatureSection.js– top-level UI section for the featureapiClient.js– feature-local transport and server callscomponents/– reusable presentation-oriented feature componentssections/– store-aware or feature-local UI fragments
Rules
- keep feature-specific code inside the feature folder
- do not move feature-specific code into
shared/too early - keep the feature folder small and understandable
- create subfolders only when the feature is large enough to justify them
Final rule
If a behavior belongs clearly to one feature, its code should usually live inside that feature folder.