Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which technology stack (modules, frameworks) is better for the first node.js project in order to study node and make a good product?

A year ago I made few small steps in node. Even then there was a great number of modules and frameworks. Now I want to learn the node environment more deeply and start a web based (service for web and mobile app) project. I understand that a lot of things depends on what sort of application you're writing, but there is always some kind of base in it.

At this point I would like to know:

  1. Is it better to start from scratch or take some kind of framework (which one in your opinion)?
  2. Which modules are of the prime importance? On which modules should I pay attention in the first place?
  3. Which databases and modules do you prefer?
  4. I've heard that you can write to coffeescript for node. What should I do for it? Or maybe it's better to use javascript?
  5. About some helpful books and tutorials about node in action.

All these questions are rather broad, but the answers will be very helpfull for all beginners

Thanks )

like image 572
pronevich Avatar asked Feb 21 '23 05:02

pronevich


2 Answers

I will try answering your question from the view of someone who has tried getting into Node.js through concurrent development of an identical project with different combinations of 'state of the art' modules.

  1. The complexity of your project dictates the approach, as usual. If you want to learn the whole range of the intricacies of Node, you can build from scratch and just use relevant libraries (such as connect and database layer abstraction such as cradle or mongoose, more in Answer 2.) when you have the need for them.

    If you want to have a codebase from which you can find workable solutions, you should go for the Express framework (built upon connect), since it seems to be the most widespread among node developers. Many tutorial sites supply easy-to-follow examples that include this framework. The Bogart module will do the same, but it is not as publically known.

  2. Apart from Express, you might want to look into a Templating System for your HTML output. I would suggest Jade for that. I will explain why in Answer 4. An alternative would be Moustache or EJS.

    Then you should check out cradle or mongoose, since these modules will be needed for convenient DB access. Now that core functionality and DB are covered, you might want to look into LESS or SASS modules for CSS magic.

    Authentication can be handled by everyauth, it supplies twitter, facebook and many more oauth functions.

  3. I think i have covered the modules in 2. already, so now onto the DB question. I did enjoy working with MongoDB, and you can easily go with that and find alot of documentation and best-practices on the Internet. I myself have found CouchDB much more interesting, since it provides a fantastic API-based access and it's catchphrase is "Relax." - but it is not really that important. As long as you understand the NoSQL-approach that drives mongo and couch, you can use any of them. I strongly suggest to avoid traditional SQL-based databases since the JSON-formatted output of the NoSQL database systems integrates seamlessly into the JavaScript-environment that is Node.js.

  4. I developed with JS and Coffee and i can tell you one thing: with a cup of the latter, you will have a much easier time getting your projects up and running. Indentation-based programming plays hand in hand with Jade Templating system, which is also indentation-sensitive. Having the same mindset for server code and view code (and CSS, even thou indentation there is just for your own convenience) makes developing both at the same time much easier. I have yet to find a problem from JS that could not be solved with a much more beautiful CoffeeScript expression.

  5. Follow the node project on github, follow the Express/Connect/cradle/Jade/mongoose/..-project on github, google for "blog node express tutorial" and try joining the IRC community on irc.freenode.net. The interesting channels there would be #node.js and maybe ##javascript. From there on, people will show you to more specialized rooms. I strongly suggest you go there, it is a very helpful bunch.

    The O'Reilly publisher has some very good books, but they are outdated the moment they are shipped to the bookstore. Since the community is developing new features and versions on a daily basis, you should try to get as close to the developers of the core functionality as possible. On IRC, you can even ask them with your (probably mildly interesting) problems - you will get answers and hints nonetheless.

    In short: stay in touch with the community.

like image 167
arvidkahl Avatar answered May 01 '23 14:05

arvidkahl


  1. Connect is a powerful and flexible mini-framework. With the right set of modules it is the best solution, I think.
  2. node-mongodb-native for MongoDB, db-mysql for MySQL, just for templating. Use The node toolbox to find more.
  3. I use MongoDB and MySQL. It depends on the project.
  4. I use plain JavaScript but it's a matter of taste. I love native.
  5. Source code. Realy. Node.JS ecosystem is evolving very quickly. Most of the documentation out of date at the time of its writing. Use GitHub to watch for projects. This is really helpful.
like image 28
Vadim Baryshev Avatar answered May 01 '23 14:05

Vadim Baryshev