React App Folder Structure Explanation

πŸ“‚ Root Folder Structure

my-app/
β”‚
β”œβ”€β”€ node_modules/
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.css
β”‚   β”œβ”€β”€ App.js
β”‚   β”œβ”€β”€ App.test.js
β”‚   β”œβ”€β”€ index.css
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ logo.svg
β”‚   └── reportWebVitals.js
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ README.md
└── yarn.lock

1. node_modules/

This folder holds all third-party dependencies (libraries) your project needs. When you run npm install, all required packages get downloaded into this folder.

Do not modify this folder manually. It is managed by npm.

2. public/

Contains static files directly accessible in the browser. These are not processed by Webpack.

3. src/ (Source Folder)

The main folder for development where React components, styling, and logic live.

4. Configuration & Metadata Files

πŸ’‘ Where Should You Place Your Own Files?

πŸ—‚οΈ Sample Scalable Folder Structure

src/
β”œβ”€β”€ assets/
β”‚   └── logo.png
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Header.js
β”‚   β”œβ”€β”€ Footer.js
β”‚   └── Navbar.js
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ Home.js
β”‚   └── About.js
β”œβ”€β”€ hooks/
β”‚   └── useFetch.js
β”œβ”€β”€ context/
β”‚   └── AuthContext.js
β”œβ”€β”€ App.js
β”œβ”€β”€ index.js
└── index.css

✨ Important Terms Explained

Tip: Do not touch node_modules/ or public/index.html unnecessarily. Focus only on the src/ folder for development.

Summary