I'm feeling a bit confused, there are so many frameworks out there for Node.js related 'stuff'. Would someone be able to give me an overview of - how the following libraries/frameworks/whatever relate/interact with each other - what's included or what the main purpose is for each of them? - differences between them
Also, if there are any others I've left off my list, feel free to add them and a description of what they are and how they fit in too.
- Node
- Coffeescript
- Backbone
- Express
Most of the things you listed are related only because they are written in or otherwise use JavaScript. Comparing them is much like comparing apples to oranges. It's like asking what the difference is between a Toyota Camry and a V6 engine. They are related, but do different things.
Node
Also known as Node.js, Node is the JavaScript environment on which we run our server-side JavaScript code. It is based on the V8 JavaScript engine. All of the JavaScript code you write, or install and run from packages from NPM, GitHub, etc. is executed by the Node runtime environment.
CoffeeScript
CoffeeScript is, plain and simple, a programming language that compiles down to JavaScript. Its purpose is to expose all the power of JavaScript in a simpler way. It's important to keep in mind that all CoffeeScript code just gets compiled to JavaScript when you run it; the differences are purely syntactical. Its website has much more information.
Backbone
Backbone can be likened to as a Model-View-Controller framework for JavaScript. I believe it was originally written for the browser; it helps keep your client-side JavaScript clean by implementing most common MVC patterns (as well as a couple other things), allowing you to more easily connect your client-side JavaScript to your server-side code.
Express
Express is a web framework for Node.js built on Connect. It is similar in many aspects to Sinatra for Ruby. It allows you to easily create web sites with routing, layouts/partials/views, sessions, and more. There are a lot of third-party modules for Express, making it pretty easy to get exactly the kind of stack you need.
There are a ton of modules out there for Node; as of this writing, NPM has over 3,000 published packages, and covering even the most popular ones would take some amount of time! Be sure to give NPM or the module list page a look any time you need to solve a new problem to avoid inventing the wheel (unless you want to learn a lot about wheels. :)
With node.js you only need to choose one framework. For frameworks some popular ones are
I've only used
express
and I can vouch it is fantastic. It has a great community and fantastic support. It's also the only library I know that just works and that says a lot.Apart from that the node community uses optimized modules that solve one problem, when they need that problem solved. Frameworks should handle the minimal problems of handling HTTP request and
express
solves that.Below is an except from package.json file.
As you can see, I use one framework and a whole range of hand chosen utility libraries that solve one task. For the other tasks I roll out my own (a few of the libraries listed above are my own).
For example I used to recommend
backbone
as a solid MVC library but it just doesn't work with node. So I rolled out my own MVC abstraction. I also used to recommendcradle
as a solid CouchDB abstraction but it leaked, so I stepped down and wrote my own database access code usingrequest
to talk to CouchDB.