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!
3 Answers
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.
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.'
Good point! I appreciate the advice!
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!
That's a fantastic idea! Thank you!
Thanks for the info! That makes things clearer for me!