How to Organize Code Folders Without Losing Your Mind
How to Organize Code Folders Without Losing Your Mind - Photo by BoliviaInteligente on Unsplash
Alright, let’s get straight to it. I’ve been in the industry for over 12 years, and if there’s one thing I’ve seen everywhere—startups, big companies, you name it—it’s that everyone eventually lands on the same basic convention for organizing code on their local machines. It’s not rocket science, but it’s one of those things that, if you get it right, makes your life (and your teammates’ lives) way easier.
I’m going to show you the most common way to organize your projects locally, why it works, and a few alternatives you might run into. I’ll also share some personal tips and a bit of the history behind these conventions. Let’s dive in.
Why Consistency Matters
First off, consistency is your best friend here. If you and your teammates all keep your cloned repos in the same place, it’s a breeze to help each other out. Ever had to debug something on someone else’s computer and spent five minutes just looking for the right folder? Yeah, let’s avoid that.
“It’s like driving home—you don’t think about every turn, you just get there. Your folder structure should feel the same.”
The Standard: The Code Folder
The most common convention is to have a folder called Code (or code) in your home directory. That’s it. Super simple.
On my machine, I’m in my home directory (let’s say /home/pierre/), and I create a folder called Code. Now, you can go with lowercase or uppercase—personally, I like to capitalize the C. Why? On Linux, uppercase folders show up at the top when you list directories in the terminal. It’s a small thing, but it makes a difference when you’re jumping around quickly.
1# In your home directory
2mkdir Code
3cd Code
On Windows, you don’t get that alphabetical bonus, but the principle is the same.
Why Uppercase? A Quick History Lesson
You might notice that files like README and LICENSE are in uppercase. That’s not just for style points. Historically, uppercase filenames show up first in directory listings, especially on Unix-like systems. That way, the important stuff stands out. Same logic applies to your main folders.
How to Organize Code Folders Without Losing Your Mind - Photo by Bernd 📷 Dittrich on Unsplash
Alternatives: projects, www, and the Old School
You might see some folks use projects instead of code. That’s fine, just less common. The key is to pick one and stick with it everywhere—work machine, personal laptop, whatever.
Back in the day, especially for web stuff, people used folders like www or htdocs. That’s mostly a holdover from web server setups (think Apache’s public_html or htdocs). If you’re working with PHP or legacy web projects, you might still see this, but for most modern development, just stick with code or projects.
Organizing Inside the Code Folder
Here’s where things get interesting. Let’s say I’m working on a side project—a food tracking app. It’s got a React Native frontend and a Go backend. Instead of dumping both repos straight into Code, I create a folder for the project:
1cd Code
2mkdir food-tracker
3cd food-tracker
4git clone <backend-repo-url>
5git clone <frontend-repo-url>
Now, everything related to that project lives in one place. If I have another unrelated project, it gets its own folder. No mess, no confusion.
Real-World Example
When you’re working at a company, you rarely have just one project. Maybe you’ve got a backend API, a frontend web app, and a mobile app. Here’s how I’d lay it out:
Code/
food-tracker/
backend/
frontend/
mobile-app/
another-project/
api/
web/
If you’re at a company with multiple brands (think Booking.com, Agoda, Priceline), you might go one level deeper:
Code/
booking/
frontend/
api/
backend/
agoda/
...
priceline/
...
And if you’re dealing with microservices, just add more folders inside the project or brand folder. Some companies are moving back to monorepos, but the principle is the same: keep everything for a project or brand together.
A Note on Shared Packages
How to Organize Code Folders Without Losing Your Mind - Photo by Hitesh Choudhary on Unsplash
You might have shared components or packages used across projects. I usually keep those inside the relevant project folder, or if they’re truly global, maybe a shared or libs folder at the top level. Just make sure you know where to find them.
The Bottom Line
Organizing your workflow this way is a game changer. You’ll always know where you are, what you’re working on, and you’ll never lose track of your projects. Whether you’re a total beginner or a senior engineer, this is one of those habits that pays off every single day.
“Consistency is key at the end of the day.”
Key Takeaways
- Use a top-level
Codeorprojectsfolder in your home directory. Capitalize if you like, especially on Linux. - Create one folder per project inside your code folder. Don’t mix unrelated repos together.
- For companies with multiple brands or lots of microservices, nest folders by brand and project.
- Stick to the same convention across all your machines and with your team. It saves time and headaches.
- Legacy folders like
wwworhtdocsare mostly for old-school web projects. For modern work, usecodeorprojects. - Consistency beats cleverness. Make your folder structure boring and predictable.
“Your folder structure should be so obvious you never have to think about it.”
Pierre-Henry Soria
#Code Organization #Development Workflow #Folder Management #Money #Productivity #Project Organization #Repository Structure #Tech #Time-Management