How to Structure a React Project for Modularity and Reusability
Takahiro Iwasa
1 min read
React
Directory Structure
- components
- Contains simple and abstract common components.
- These components are used across the project and can be considered application-wide parts.
- core
- Holds the application-core functionality with application-wide utilities.
- Accessible from
featuresandsharedbut must not referencefeatures.
- features
- Each feature module resides here.
- These modules may reference
components,coreorsharedbut must remain isolated from the rest of the application to maintain modularity.
- shared
- Contains shared utilities and components.
- Accessible from
featuresbut must not reference them.

src/├── assets/├── components/│ ├── Elements/│ ├── Forms/│ ├── Layouts/│ ├── Modals/│ ├── Pages/│ │ ├── Errors/│ │ │ ├── AccessDeniedPage.tsx│ │ │ ├── NotAuthenticatedPage.tsx│ │ │ ├── SystemErrorPage.tsx│ │ │ ├── ...│ │ ├── ErrorBoundary.tsx├── core/│ ├── api/│ │ ├── interceptors/│ ├── config/│ ├── hooks/│ ├── loaders/│ ├── models/│ │ ├── api/│ ├── stores/│ ├── utils/├── features/│ ├── auth/│ ├── .../├── shared/