๐Ÿ—‚๏ธ Web Dev

Folder Structure for Web Projects โ€” From Chaos to Convention

๐Ÿ“… Jul 5, 2026 โฑ 3 min read

Nobody teaches folder structure; everyone judges it. Reviewers open your repo and form an opinion in ten seconds.

Small static project

my-site/
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ css/style.css
โ”œโ”€โ”€ js/main.js
โ”œโ”€โ”€ images/
โ””โ”€โ”€ README.md          โ† the most-skipped, most-read file

App-sized (Vite/React)

src/
โ”œโ”€โ”€ components/     # reusable UI (Button, Card, Navbar)
โ”œโ”€โ”€ pages/          # route-level views
โ”œโ”€โ”€ hooks/          # useAuth, useFetch
โ”œโ”€โ”€ utils/          # pure helpers (formatDate, calcGpa)
โ”œโ”€โ”€ services/       # API calls in ONE place โ€” not scattered fetches
โ”œโ”€โ”€ assets/
โ””โ”€โ”€ main.jsx

The services folder is the sleeper: every fetch in one layer means auth headers, error handling and base URLs change in one file.

Scaling rule: group by feature, not type

# past ~20 components, flip the axis:
src/features/
โ”œโ”€โ”€ auth/        # ITS components, hooks, api, tests together
โ”œโ”€โ”€ results/
โ””โ”€โ”€ playground/

Everything about a feature lives together โ€” deleting a feature is deleting a folder.

The consistency laws

โ† All Articles