DEV Community

Discussion on: Domain-driven Design (DDD): File Structure

Collapse
 
stevescruz profile image
Steve Cruz

You are right, I can view more clearly the domain and the infrastructure groups, but sometimes I lose sight of the application group.

Thanks for sharing this file structure, it is very organized. I love seeing how other people structure things.
Where do you store your routes (I imagine in the web folder at infrastructure)? and your controllers and why?

Thread Thread
 
goceb profile image
Goce

Controllers are part of the infrastructure layer so, Infrastructure/Web is where all the web related stuff sits. Console is for console commands (still in Infrastructure). Routes on the other hand exist in an independent file just for routes (not a big fan of annotations), dependencies are defined in a separate file too, which aggregates the different dependency providers for each BC or module. I use PHP (no framework) but I think this approach is language agnostic.