Ionic big project structure

1.4k views Asked by At

I'm building a mobile app that is a port from a web-app and I'm trying to create the skeleton.

I have an admin center with a lot of different views that share one thing in common, they show all registers, create, update and delete. For example, I have one section for users where the first page shows all users, then there is a button to create and one for update that sends to different views.

The project skeleton would be something like this:

/users
    users.html // show all users
    users_create.html // creates user
    users_update.html // update specific user
    users_detail.html // show specific user
/posts
    posts.html
    posts_create.html
    posts_update.html
    posts_detail.html
/communities
    communities.html
    communities_create.html
    communities_update.html
    communities_detail.html

.... much more the same for other sections

My question is, what would be the best approach to build this with ionic? to have all this folders or just one common folder and resolve everything (number of fields, name of fields, etc) by passing a param to the route?

I ask you sorry if I didn't explain it very well but I hope you catch the idea of what I'm trying to say.

Thanks!

1

There are 1 answers

0
Nikola On BEST ANSWER

From the awesome book MEAN Web Development by Amos Haviv you can learn that there are basically two folder structures you can opt for:

  • Horizontal folder structure

A horizontal project structure is based on the division of folders and files by their functional role rather than by the feature they implement, which means that all the application files are placed inside a main application folder that contains an MVC folder structure. As you can see, the horizontal folder structure is very useful for small projects where the number of features is limited, and so files can be conveniently placed inside folders that represent their general roles.

  • Vertical folder structure

A vertical project structure is based on the division of folders and files by the feature they implement, which means each feature has its own autonomous folder that contains an MVC folder structure.

So, in your case, what I would actually do is go with the Vertical folder structure (since you said the app is (is going to be) big, where you would (in your case) have a users folder where you would then have folders controllers, views, model (in case you're using it) and all the appropriate files inside it. You can view the folder structure in action if you take a look at the project mean.js from the same author as the book.