Feature-First Organization
Features are the primary organizing principle. Each feature represents a business capability and contains everything it needs to function.Anatomy of a Feature
A well-structured feature follows this pattern:Real-World Examples
E-commerce Shop Feature
- Next.js
- Angular
- Astro
Component Organization Within Features
Naming Conventions
Main Component Naming
The main component MUST match the feature name:
- Feature:
user-profile→ Component:user-profile.tsx - Feature:
dashboard→ Component:dashboard.tsx - Feature:
product-catalog→ Component:product-catalog.tsx
Component Hierarchy
Service Layer Organization
Feature-Specific Services
Services that are specific to a feature stay local:- Next.js
- Angular
- React
Hook Organization
Custom hooks encapsulate feature-specific logic:Type Definitions
Feature-specific types stay local:Utility Functions
Feature-specific utilities:When to Extract from a Feature
Keep Local
- Used only within this feature
- Contains feature-specific business logic
- Tightly coupled to feature data models
- Not reusable in other contexts
Extract to Shared
- Used by 2+ features
- Generic, reusable logic
- No feature-specific dependencies
- Provides value across features
