Starting a programming project is exciting, but a few weeks of adding files can quickly turn a tidy folder into a confusing pile. A simple structure helps you find code, assets, documentation, and tests without making a beginner project feel like enterprise software.
Why folder organization matters
Folder organization is not just about making a project look professional. It affects how easily you can answer everyday questions:
- Where is the main program?
- Where should a new module go?
- Which files can be edited safely?
- Where do images, sample data, or configuration files belong?
- How can another person run the project?
- Which files should be committed to Git, and which should stay local?
When everything is stored in one folder, the project may work at first. However, names such as test2.py, new_version.js, image-final-final.png, and notes.txt make the project harder to maintain. A predictable structure reduces the amount of time you spend searching and lowers the chance of editing the wrong file.
Good organization also makes growth less painful. You do not need to predict every future feature. You only need a structure that separates different kinds of files and gives new files a sensible home.
Start with a project root folder
Create one main folder for the entire project. This is called the project root, or root directory. Give it a short, descriptive name using lowercase letters and hyphens or underscores.
For example:
weather-dashboard/
Avoid names that depend on your computer, such as Desktop Project, Coding Stuff, or weather-dashboard-final2. Spaces are supported by many tools, but simpler names reduce problems in terminals, scripts, and deployment systems.
The root folder should contain the files and folders that belong to the project, but not unrelated downloads or other projects. Open your code editor at this root folder so that file paths, search, version control, and terminal commands all use the same starting point.
A small beginner project can start with this structure:
weather-dashboard/
├── README.md
├── src/
│ └── main.py
├── tests/
├── assets/
├── data/
└── .gitignore
You do not need to create every possible folder immediately. Add a folder when you have a real reason for it. Empty folders can make a project feel more complicated than it is.
A practical beginner folder structure
The following structure works well for many small Python, JavaScript, Java, and web projects:
my-project/
├── README.md
├── src/
│ ├── main.py
│ ├── helpers.py
│ └── models.py
├── tests/
│ ├── test_helpers.py
│ └── test_models.py
├── assets/
│ ├── logo.png
│ └── styles.css
├── data/
│ ├── sample-data.json
│ └── README.md
├── docs/
│ └── decisions.md
├── scripts/
│ └── import_data.py
├── requirements.txt
└── .gitignore
Here is what each part is for:
| Folder or file | Purpose | Typical contents |
|---|---|---|
src/ | Main source code | Modules, classes, components |
tests/ | Automated or manual tests | Test files and fixtures |
assets/ | Files used by the application | Images, fonts, CSS, icons |
data/ | Input or sample data | JSON, CSV, SQLite files |
docs/ | Project notes | Design decisions and instructions |
scripts/ | Utility programs | Import, cleanup, or setup scripts |
README.md | Project guide | Setup, usage, and structure notes |
.gitignore | Files Git should ignore | Secrets, caches, generated files |
The exact names are flexible. For example, a web project may use public/ for browser-served assets, while a Python project may use app/ instead of src/. Consistency matters more than choosing the one universally correct name.
Step 1: Separate source code from supporting files
Put code that directly runs the application in src/ or a similarly named application folder. This prevents source files from being mixed with screenshots, exported reports, downloaded data, and notes.
For a command-line Python program, you might use:
budget-tracker/
├── src/
│ ├── main.py
│ ├── transactions.py
│ └── reports.py
For a small website, the equivalent may look like:
portfolio-site/
├── src/
│ ├── index.html
│ ├── app.js
│ └── styles.css
├── public/
│ └── images/
Keep related code together, but do not create a separate folder for every single file. A folder such as src/utils/date/formatting/ is usually excessive for a beginner project containing one date helper. Start shallow and reorganize only when a group of files becomes difficult to navigate.
Step 2: Create a clear entry point
Every project should make it obvious where execution begins. Depending on the language, this might be main.py, app.py, index.js, Main.java, or index.html.
Use one recognizable entry point and document how to run it. For example, a Python project might use:
python src/main.py
A JavaScript project might use a command defined in package.json:
npm run dev
Avoid having several files that appear to be the main file, such as main-new.py, main-working.py, and main-old.py. If you need an experiment, put it in a clearly named experiments/ folder or create a separate temporary project. Remove obsolete copies once you know which version is current.
Step 3: Organize files by responsibility
As your code grows, group files according to what they do. For example, a simple task manager might have:
src/
├── main.py
├── tasks.py
├── storage.py
├── validation.py
└── display.py
Each file has a focused responsibility:
tasks.pydefines task-related operations.storage.pyreads and writes data.validation.pychecks user input.display.pycontrols output or presentation.main.pyconnects the pieces and starts the program.
This does not mean every file must contain only one function. It means files should have a reason to exist. If main.py grows to hundreds of lines and handles input, database access, validation, and formatting, move related sections into separate modules gradually.
Do not split code just to achieve a certain number of files. Too many tiny modules can make a beginner project harder to follow. A useful rule is to create a new file when a responsibility can be named clearly or when an existing file is becoming difficult to navigate.
Step 4: Keep tests separate and close to the code conceptually
Put tests in a tests/ folder so they do not get confused with application code. Use names that reveal what they test:
tests/
├── test_tasks.py
├── test_storage.py
└── test_validation.py
This layout is easy to understand and works with many testing tools. Some frameworks instead place tests beside source files:
src/
├── tasks.py
├── tasks.test.js
├── storage.js
└── storage.test.js
Both approaches are valid. A separate tests/ folder is often easier for beginners because it keeps production code and test code visibly distinct. A colocated layout can be convenient when each module has a closely related test and the project tooling supports it well.
If tests require sample files, place those in tests/fixtures/ or tests/data/. Do not use the real production database or personal files during testing. Sample data should be small, repeatable, and safe to share.
Step 5: Handle assets, data, and generated files carefully
Assets are files the program uses but does not execute as source code. Examples include images, CSS, icons, fonts, and audio. Store them in assets/, public/, or the convention required by your framework.
Data deserves extra attention. Separate small sample files from private or generated data:
data/
├── sample-users.json
├── example-orders.csv
└── local/
└── development.sqlite
A real database, downloaded dataset, or user export may contain private information. Keep it outside version control when appropriate, and document how someone can create a safe sample version.
Generated folders such as dist/, build/, .cache/, node_modules/, and Python virtual environments usually should not be manually edited. They are created by tools and can normally be regenerated. Add them to .gitignore when they should not be committed.
Step 6: Use README files as navigation aids
A good README.md is the project’s front door. It does not need to be long. Include enough information for a new reader to understand and run the project:
# Budget Tracker
A small command-line app for recording expenses.
## Requirements
- Python 3.11 or newer
## Run the project
python src/main.py
## Run tests
python -m pytest
## Folder structure
- `src/` application code
- `tests/` automated tests
- `data/` safe sample data
Add another README inside a folder only when that folder needs special instructions. For example, data/README.md can explain the expected CSV columns, while docs/README.md can describe how notes are maintained.
Documentation should describe the current project. Delete or update instructions when commands, filenames, or dependencies change. Outdated documentation is often more confusing than no documentation.
Naming rules that prevent confusion
Choose naming rules before the project becomes large. Useful guidelines include:
- Use lowercase names for folders:
src,tests, andassets. - Use one separator consistently, such as hyphens or underscores.
- Use descriptive names instead of numbers:
user_profiles.pyis clearer thanfile3.py. - Match related names:
tasks.pyandtest_tasks.pyare easy to connect. - Avoid spaces and special characters that have meaning in shells.
- Do not use names that conflict with standard libraries, such as
random.py,json.py, oremail.py, unless you understand the consequences. - Avoid vague folders such as
misc,stuff, andold.
For versions, use Git branches, commits, or release tags instead of copying a project into folders named project-final, project-final2, and project-final-real.
Choosing between common alternatives
There is no single folder structure for every language or project. Choose the smallest convention that matches your tools.
A very small script can use:
hello-script/
├── hello.py
└── README.md
A Python package may use:
calculator/
├── pyproject.toml
├── src/
│ └── calculator/
│ ├── __init__.py
│ └── operations.py
└── tests/
A frontend project may use:
shop-ui/
├── src/
│ ├── components/
│ ├── pages/
│ ├── services/
│ └── styles/
├── public/
└── package.json
A school assignment may need to follow a teacher’s required layout. In that case, follow the assignment specification even if another structure is more common. Frameworks can also impose conventions. Learn the tool’s expectations before renaming special folders such as public, static, pages, or app.
Troubleshooting common organization problems
Imports or file paths stop working
Moving files changes their paths. Update imports, configuration files, build settings, and run commands together. Prefer paths relative to the project root or the conventions supported by your language and framework. Avoid scattering absolute paths such as C:\Users\YourName\Desktop\... through your code.
The program cannot find an asset
Check the path from the process’s working directory, not only from the file where the code appears. A program launched from the root may resolve assets/logo.png differently from a program launched inside src/. Use one documented launch command and test paths from that command.
The folder has become too deeply nested
Flatten it. If you need several clicks to reach a normal source file, some folders may be unnecessary. Group by meaningful responsibility, not by every concept mentioned in the code.
You are unsure where a file belongs
Ask what the file represents. If it is executable application code, use src/. If it is a test, use tests/. If it is an image or stylesheet, use the asset folder. If it is a tool for developers, use scripts/. If none of those answers fit, document the decision and use a name that explains its role.
Git shows files you never meant to commit
Update .gitignore for generated files, environment settings, secrets, and local databases. Never commit passwords, API keys, private exports, or personal configuration. If a secret was already committed, removing it from the latest file is not always enough; rotate the secret and follow your hosting provider’s removal guidance.
A simple organization routine
When starting a new beginner project, use this sequence:
- Create one root folder with a stable name.
- Add a short
README.md. - Create
src/only if there is more than one source file or if your tool expects it. - Add a clear entry point.
- Add
tests/when you write the first test. - Add
assets/,data/,scripts/, ordocs/only when those categories appear. - Add
.gitignorebefore creating local environments or generated output. - Run the project from the documented root command.
- Reorganize when a folder becomes confusing, not merely because a tutorial uses a different layout.
The best beginner folder structure is predictable, small, and easy to explain. Keep the root readable, separate code from supporting files, name files by responsibility, and document the commands that make the project work. As the project grows, make one deliberate change at a time and verify paths immediately afterward.