React.js Project Structure
A scalable and maintainable folder structure for React.js applications
File Structure
- src
- index.js
- App.js
- components
- Header.js
- assets
- logo.svg
- public
- index.html
- favicon.ico
- package.json
- README.md
Directory Structure Explanation
src/
This folder contains the main source code for the React application. All the application's core logic, components, and assets are placed here.
src/index.js
The entry point of the React application. This file renders the root component (usually App) and attaches it to the DOM.
src/App.js
The root component of the application. It typically includes the main layout and routing logic.
src/components/
This folder contains reusable React components. Components in this folder are smaller units of the UI that can be used in different parts of the application.
src/assets/
This folder is used for storing static assets like images, fonts, or global styles that will be processed by the build tool.
public/
This folder contains static assets that are served directly. It includes the main HTML file and other assets like the favicon.