At the beginning it did not feel like a problem. Everything was small and simple. Just a few files, nothing too crazy. I knew where everything was because there was not much to keep track of.
But after a few days things started getting confusing. I would open the same project again and not really understand what I did before. I had to look through files just to figure out where something was.
Sometimes I would just change things randomly until it worked again. Not the best way, but that is how it was back then.
I remember once I spent ages looking for a small function I knew I had written somewhere. I had thrown it into some random file and didn’t even remember the name of it. At that point it kind of hit me that I should probably start keeping things a bit more organized.
Key Takeaway
If your project still makes sense to you after some time then your structure is already good enough.
1. I stopped overthinking the structure
Before I used to think I needed some perfect folder structure. I would create a lot of folders before even writing code.
I would spend more time organizing empty folders than actually building something.
Now I do not do that anymore. I just start simple and build from there.
project/
index.html
css/
js/
images/
Most of the time this is enough. I do not need anything more in the beginning.
If the project grows then I change things later. I might add more folders split files or reorganize a bit. But only when I actually need it.
2. File names can get confusing fast
One mistake I made a lot was naming files randomly. Things like final.js, last.css, newfile2... stuff like that.
At the moment it feels okay you are just trying to move fast. But later it becomes confusing.
You open the folder and you see a bunch of names that do not tell you anything. Then you have to open each file to understand what it does.
Now I try to name things in a way that I understand later. Not perfect just clear.
Even something simple like navbar.js or layout.css is already much better.
3. I try not to mix everything
I used to put everything together. HTML, CSS, JS all in one place. Sometimes even in one file.
It works at first especially for small things. But it gets messy really quick.
Now I separate things. HTML in one place, CSS in another, JavaScript separate.
It is easier to read, easier to edit and less confusing overall.
Also when something breaks it is easier to find where the problem is.
4. I noticed I repeat code a lot
After building a few projects I realized I was writing the same code again and again.
At first I did not think much about it but after some time it felt like a waste.
So now if I see something useful I keep it. Nothing special just small parts I know I will use again.
It can be a simple function or a small component. It saves time later.
I do not overthink this either. I just keep things that I know I will probably need again.
5. Laravel helped me a bit
When I started using Laravel I understood structure a bit better.
At first it looked complicated. There were a lot of folders and files and I did not really know what everything was for.
But after using it for a bit it started making sense.
Everything has its place. Controllers do one thing, models another, routes are separate.
It kind of forces you to stay organized, even if you are not thinking about it.
That helped me even in smaller projects outside Laravel.
6. I do not try to be perfect
Before I wanted everything to be perfect from the start.
Perfect structure, perfect names, everything clean.
That just slowed me down.
Now I just build. If something gets messy I fix it later.
Projects change anyway. What you plan at the start is not always what you end up with.
7. Consistency helps
I try to keep things similar across the project.
Same naming style same kind of folder structure.
It is not perfect but it helps a lot when I come back later.
I do not have to think too much I already know where things are.
8. Sometimes it still gets messy
Not every project I build is clean. Sometimes it still gets messy especially when I am working fast.
For example when I am testing something quickly I might just throw code somewhere and move on.
Later that can create a bit of a mess.
When that happens I just clean it up a bit. Move files, rename things, delete stuff I do not need.
Nothing complicated just small fixes.
Simple Approach
For me project structure is not something complicated.
I just try to keep things simple so I do not get confused later.
If I understand my own code after a few days that is already enough.
The rest just comes with time and practice.