Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to organize frontend and backend project structure in node.js? [closed]

In my project I want to use coffeescript for both backend and frontend to develop it all in one programming language. Below is a list of modules I'm going to use:

Backend

  • coffeescript
  • node.js
  • express.js
  • mongodb
  • redis
  • jade
  • stylus

Frontend

  • coffeescript
  • angular.js
  • jade
  • stylus

Note that some modules are used both in backend and frontend: coffeescript, jade, stylus.

I've used npm to manage server side modules and bower to manage client side modules. I've decided to keep it all as one project for easier maintenance and code sharing. I've used grunt as javascript task runner.

My questions is:

Is there a single tool that automatically generates project in a configuration mentioned above and provides basic file structure and examples?

like image 478
ezpn Avatar asked Oct 21 '22 00:10

ezpn


1 Answers

Structuring MEAN projects

What you've just described is the MEAN stack.

There are a boatload of MEAN frameworks which promote good practice. Consider looking at these two, but also google the heck out of the topic if you're interested:

  • MEAN.js
  • Sails.js (which I'm using for a project at the moment)

You might want to have a look at tutorials like Thinkster.io's on the MEAN stack.

Managing dependencies

Managing dependencies should never be more of a hassle than adding libs to your package.json or bower.json files and require()'ing or otherwise loading those installed dependencies. Thankfully we've got a good suite of package managers for all aspects of the MEAN stack:

  • See NPM, the node back-end JS package manager, which you'll use for your server-side dependencies. [Getting Started with NPM]
  • See also Bower, the front-end * package manager, for clientside JS libs, css frameworks and the like. [Getting Started with Bower]

Grunt as a taskmanager

  • I'd encourage you to consider Gulp as opposed to Grunt, for it's flexibility and improved performance [Getting Started with Gulp]
like image 128
yellow-saint Avatar answered Oct 23 '22 07:10

yellow-saint