vroqjs.com

04-code-organization/02-features.md

Features

Features

A feature is a coherent slice of application behavior.

In Vroq apps, a feature usually owns its reducer, actions, sections, and feature-local API helpers. Features are the main unit for grouping app behavior.

When to create a feature

Create a feature when:

  • the behavior represents a distinct app capability
  • state and actions belong together
  • UI and API logic are easier to understand when grouped
  • the behavior may grow independently over time
  • debugging benefits from a separate ownership boundary

Examples:

  • files
  • editor
  • debugger
  • settings

What a feature should own

A feature will often own:

  • reducer
  • actions
  • top-level feature section
  • feature sub-sections
  • feature-local API client
  • feature-local components when needed

What a feature should usually avoid

A feature should usually avoid:

  • putting generic cross-app logic in the feature folder
  • reaching deeply into unrelated feature state
  • duplicating helpers that already exist in shared code

Why features matter

Features make it easier to:

  • find the code that owns a problem
  • change one behavior without touching unrelated parts
  • keep reducers and UI aligned
  • debug using feature-local action names and state slices

Final rule

Create a feature when a behavior has enough UI, state, or API ownership to deserve a clear boundary in the project structure.