0

I'm searching for a video/blog post or something related that help me organize my node.js web application.

I have an application where i am using express.js upon node.js.

I'm using:

Mvc pattern, 
i18n, 
config env prod/dev, 
custom middlewares, 
custom prototypes
custom modules 

I need organize better the folder structure, but i don't know exactly how.

I already search for this, but i was only able to find poor explanations about an good folder structure in a node.js app.

The app also have an admin dashboard, so i am separating the public, views and controllers like this:

public
|-- admin
|-- client
views
|-- admin
|-- client
controllers
|-- admin
|-- client

This is a good idea?

Anyone knows a good book, video or blog post that can help me with my problem?

2 Answers2

2

This looks like a pretty solid thread on Node App structure.

In my own opinion, I always try to follow the rule of never repeating yourself in development. Looks like you are repeating your structure a lot above. If I were you I would do one of the following:

  1. Make two separate Node apps. One for clients and one for admin.
  2. If your controllers are going to be similar for both client or admin, I would consider building one app that identifies a user as a general user or an admin and render their experience that way. Then just throw away the admin/client folders.

EDIT:

Scotch.io always has great articles on Node and Express. See if this article or their other articles help.

Best Answer:

After some team research we found this link to be most useful. It has a great five folder layout for an admin panel and client experience.

Community
  • 1
  • 1
Max Baldwin
  • 3,404
  • 3
  • 26
  • 40
  • my controllers in the admin/client have the same name, but the logic is totally different, that's why i separate in two different folders :B. –  Feb 18 '15 at 16:58
  • @DRX I mean if that is the case, why not just create to different Node apps? It would be more organized, faster and probably safer. – Max Baldwin Feb 18 '15 at 17:00
  • separating in two different apps is a good alternative for large applications i think, in my case is not necessary unfortunate =(.. –  Feb 18 '15 at 17:01
  • You mean you aren't building Facebook? :P I mean still, it would be more organized and probably easier to read. – Max Baldwin Feb 18 '15 at 17:02
  • https://gist.github.com/lancejpollard/1398757 what you think about the 5: Top-level /client and /server directories ?? –  Feb 18 '15 at 17:04
  • Yeah this is probably the best you are going to get. I am going to save this. See where he/she has their views folder? You should follow that pattern. Admin also in helpers. This looks like what you were looking for. – Max Baldwin Feb 18 '15 at 17:14
  • thanks for your help @MaxBaldwin :). I am going to use the 5 pattern. –  Feb 18 '15 at 17:16
  • @DRX awesome! And good luck. I am going to add that link to my answer. – Max Baldwin Feb 18 '15 at 17:17
-1

this is best book for meanStack development if want to read it free you need to search in google books

it is really awsome book

http://www.amazon.com/MEAN-Web-Development-Amos-Haviv/dp/1783983280/

there is the google books link

https://docs.google.com/file/d/0Bznbl5Dlz2VEcW40aWF2YUJTQUU/edit
Rana Ahmer Yasin
  • 437
  • 3
  • 17