✅ Unclear file structure
+---.github
| ---workflows
---API
+---Controllers
+---Data
+---Filters
+---Middleware
+---Migrations
+---Models
+---obj
+---Options
+---Properties
+---RESTFiles
+---Services
This is my current folder structure. It feels very unclear and way too messy. How can I clean this up?
I was thinking about putting Filters, Middleware and Options in the same folder as they're related. I wasn't sure how to name the parent folder of that though.
I have about 9 controllers, the same amount in services and a few more models.
15 Replies
Grouping things by what they are instead of what they relate to tends to get messy
I personally much prefer $vsa
Should I try (I think it's called) domain-driven design? Where you put everything related to a theatreshow together.
Instead of categorized by what they are, group by their goal kind of
ye
Alright, is that kind of the same as the VSA?
ye
I took a quick peek
okok
Thank you once again @Pobiega
You the 🐐
Oh wait
Where would Middleware etc go in this?
Seeing as theyre not really related to any specific domain
Would that be "Security" maybe?
could be, sure
What would you suggest?
well idk what your middleware does 😄
but if it deals with auth or security, that seems fine
I have a middleware that logs and a filter that checks for an API key on certain requests.
And an option for the filter
Ah I guess, a Logging directory and Authentication/Security one
could do that, but if its just a single item in the folder, you can just keep it at top level
Really, there are no strictly right/wrong answers, and I often end up reorganising things for clarity as the project develops
Just be consistent and predictable
:peepoNoted:
Alright, thank you everyone.
$close
If you have no further questions, please use /close to mark the forum thread as answered