Understanding the application directory structure
Code organization in a filesystem plays an important role in application development. It provides solutions to several problems such as the following:
Managing the separation of concern for views, models, collections, and routers
Defining a clear entry point to the application
Proper namespacing
The directory structure that we are going to propose here is not something that will work universally for every application. As JavaScript doesn't provide an inherent code organization mechanism, there is no single pattern that is best for all the applications; it solely depends on the situation. You are free to use the following structure, and lots of developers use it for their projects without any issues:
We kept all of the static assets inside the assets
folder. You can add more folders if you have other types of static resources. The templates are stored in a separate directory that matches the views
folder structure. We will load these templates...