这篇文章还没有中文版,下面显示的是英文原文。
React Folder Structure for Beginners: A Clean src Folder You Can Copy
A simple, scalable React folder structure: assets, components, data, pages, store and utils, shown in a music dashboard built with React and Vite.
A messy src folder makes a React project hard to read and hard to grow. In this lesson I set up a clean structure inside a real project: a music dashboard with a sidebar, a hero banner, a playlist section and a music player.
▶ WATCH ON YOUTUBEWatch the video
▶ WATCH ON YOUTUBEFull video
Create the project
I create a new React project with Vite, using the React template, and call it Rainy Studio. Then I go into the folder and install the default packages. If you have never done this, start with the React + Vite setup lesson.
The libraries in this dashboard
| Library | What it is for |
|---|---|
| React Router | Page navigation |
| Zustand | Global state, such as the current song and play or pause |
| Tailwind CSS | Styling |
| Lucide React | Clean, modern icons |
| Motion | Smooth animation |
| Howler and WaveSurfer.js | The audio player and the waveform |
After installing, I open the project in VS Code and delete the default files I do not need, such as the React logo and the starter styles. That gives a clean start.
The folder structure
Inside src, create these folders:
src/
assets/ images, icons, demos and audio files
components/ reusable UI parts: button, card, sidebar, player controls
data/ demo songs, playlists and artist data
pages/ main pages: home, albums, artists
store/ global state with Zustand
utils/ helper functions, such as formatting music timeEach folder has one job. That makes the project cleaner, easier to understand and easier to scale.
Pattern 1: component-based architecture
Split the UI into small, reusable pieces. A playlist card is a good example:
const PlaylistCard = () => {
return <div>Playlist card</div>;
};
export default PlaylistCard;constdefines the component, and the arrow function runs when the component is used.returnsays what appears on the screen.- The
<div>is the container for the card. export defaultlets you import the component in other files.
Pattern 2: data-driven UI
Keep data apart from design. Do not write playlist names directly in the markup. Store them in a JavaScript file:
export const playlists = [
{ id: 1, name: "Chill Vibes" },
{ id: 2, name: "Rainy Night" },
];Each item has an id and a name. Because the list is exported, any component can import it and draw one card per item. To add a playlist, you change the data, not the layout.
Run it
npm run devOpen the local URL in the browser and the dashboard is running.
Links
- Full video: https://youtu.be/aG820AoJFN0
- Previous lesson: React + Vite setup
- Next step: Next.js 16 tutorial for beginners
How do you organise your own src folder?


