How I kept my sanity? I think?
This isn’t about learning JavaScript itself. You probably already know that beast. This is about how to organize your files and folders so your SaaS project doesn’t end up looking like a digital junk drawer.
I’ll walk you through the folder structure that helped me keep things (somewhat) sane while building The Remoties a platform for remote workers and digital nomads to discover great work/study spots.
We’re talking real-world folder setup. Not abstract theory. Not corporate over-engineering. Just battle-tested organization with JavaScript (and probably TypeScript, let’s be real).
Here's the general folder layout that made the chaos manageable:
📁 /pages → Where your page routing happens. Simple stuff.
📁 /layouts → Wanna have a reusable header, footer, link to your Only fans? Put your layout components here.
📁 /types → You like TypeScript? Of course you do, you little weirdo. Put your types here.
📁 /components → Don’t just copy/paste ChatGPT's massive one-pager. Break it down into reusable pieces.
└── mainPage/
└── components/
├── View.vue
├── Junk.vue
└── Table.vue (or .tsx if you're a React nerd)
📁 /services → All your API-calling functions live here. Keep them clean and DRY. For the lols.
📁 /composables → "What the hell is that?" Good question. It's just global logic or functions you reuse everywhere.
Write once, stop being a typing monkey.
📁 /assets → Yeah yeah, you know this one. But let's break it down:
└── styles/
└── sounds/
└── exports.ts
📁 /utils → Why? Because you’ll need to store your giant ass arrays (e.g. dropdown options)
or your dynamic table columns.
└── columnsOfParthenon.ts
└── bigAssArrays.ts
📁 /themes → Useless as hell, but hey, the designer inside you needs to vibe. So go nuts.
📁 /locales → in case you wanna share your bs digital app multi-culturaly then here is where you should store your translated jsons
📁 /test → I know you are a sicko. so thats why this is here.
📁 /store → Now THIS is where the magic of state management happens. State is everything.
So is life. Just one big global state.
└── user.ts → Break it down into separate stores depending on your state manager.
This one holds user info, obviously.
📁 /lib → Where your big-brain logic lives. Not tied to Vue, React, or your feelings. Just cold, reusable, framework-agnostic power.
Put your API clients, data wranglers, validators, slug machines, and anything smart enough to survive on its own in here.
📁 /mappers → Got bloated backend data that looks like someone dumped a database on your lap?
This is where you clean it up and turn it into something useful. Map it, filter it, rename it whatever it takes.
└── hugeDildoOrder.ts → Yep, even for the wildest stuff. Create separate mapper files for each beast you tame.
Check some example github