Node Roundup: Cluster Live, Nib, Capsule

2011-04-27 00:00:00 +0100 by Alex R. Young

Node v0.4.7

Node v0.4.7 is out. This release includes bug fixes and documentation improvements. If
you're interested in reading more on the bug fixes, the numbers in the
release notes refer to the GitHub issue tracker, for example:
#897. Because the comments in the release notes are short it can be illuminating to read more.

Cluster Live

TJ Holowaychuk released Cluster

(GitHub: visionmedia / cluster-live, MIT
License), which is a realtime administration and statistics plugin for
Cluster. If you've been holding off on Cluster, this is probably the
sort of usage TJ envisioned for it and may convince you to use it.

It needs a bit of configuration to get it going:

var live = require('cluster-live');

  .set('workers', 6)
  .use(cluster.stats({ connections: true, lightRequests: true }))

I really like the simplified design TJ has used for the interface, and
if you look at cluster-live's Stylus

you can see how he's split them up into separate files, using
@import to load each one. More useful lessons for those of
you who are interested in Stylus can be found in these files.

Extend Sylus with a Nib

Speaking of Stylus... TJ wrote Extend Sylus with a

which is a post about Nib (MIT
License), a library of Stylus extensions. Nib comes with lots of useful
shortcuts for dealing with CSS gradients and even buttons -- these
buttons can be generated very quickly with Nib:

You've probably seen these in some of TJ's recent projects and examples.
Rather than writing a bunch of CSS or Stylus, these buttons can be
created with Nib using functions:


  bold-button(glow: #00ABFA)

An optional dependency is
node-canvas which Nib will use to generate data URIs containing smooth linear gradients.


Capsule (MIT License) by Henrik Joreteg is a Node framework that uses Socket.io and Backbone.js to
synchronise models between the client and server. He's written some
documentation for
Capsule.models.js and
Capsule.views.js, and the README includes a detailed example of how to set things up for
the server and browser.

It's hard to see how useful this framework is without an application
example, but Henrik suggests reading Re-using Backbone.js Models on the
server with Node.js and Socket.io to build real-time

which covers some of the concepts behind Capsule.

He also mentions an unreleased library called Thoonk.js which aims to
improve the scalability of this approach by using Redis's clustering and
pub/sub capabilities.