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

0
1
Asked By CuriousCoder93 On

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

Answered By SymfonyFan75 On

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.

CuriousCoder93 -

Thanks for the info! That makes things clearer for me!

Answered By WebDevGuru98 On

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.'

CuriousCoder93 -

Good point! I appreciate the advice!

Answered By CodeCrafter23 On

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!

CuriousCoder93 -

That's a fantastic idea! Thank you!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.