What's a Good Folder Structure for a Web App?

August 4, 2025 3 answers
Asked by trombone slide
Hey everyone! I have a simple question about setting up a web app. I'm curious if there are any recommended folder structures for both the back-end and front-end components of a web application. I've been using Symfony in my projects, but I'm considering transitioning to a tech stack that includes Node.js and frameworks like Vue.js. Here's a basic structure I've thought of so far: ``` root/ back-end/ index.php user-add.php user-del.php ... front-end/ ... ``` Any insights or examples would be greatly appreciated! Thanks a lot, and I hope you all are doing well!

Answers

_theoremH8
You're likely going to use URL rewrites, meaning you won't access files like '/user-add.php' directly. Instead, stick to Symfonyโ€™s routing for better URL management. When it comes to folder structure, structure it by features. For example, you might have `app/feature/user/controllers/foo.php` for user-related functions, and everything related to user management could be in 'user' feature folders. It makes modifications much easier later on!

trombone slide: That's a fantastic idea! Thank you!

Reply to this answer
copperplatePractice
Just a tip on naming: instead of using 'root,' maybe call it 'src' โ€“ itโ€™s more standard. Also, I wouldn't use dashes in 'back-end' or 'front-end.' For file organization, consider using 'user/add.php' instead of 'user-add.php.'

trombone slide: Good point! I appreciate the advice!

Reply to this answer
rest_8th
If you've already worked with Symfony, you might want to stick with it! You can definitely integrate Vue.js with Symfony, and there are plenty of tutorials available to help you out. Itโ€™s common not to separate folders into back-end and front-end like youโ€™ve outlined; instead, you usually organize by type, such as Controllers, Services, and more for the back-end.

trombone slide: Thanks for the info! That makes things clearer for me!

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions