DailyJS

Node Roundup: Cluster Live, Nib, Capsule

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

css node modules

Node Roundup: Cluster Live, Nib, Capsule

Posted by Alex R. Young on .
Featured

css node modules

Node Roundup: Cluster Live, Nib, Capsule

Posted by Alex R. Young on .

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
Live

(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');

cluster(server)
  .set('workers', 6)
  .use(cluster.debug())
  .use(cluster.stats({ connections: true, lightRequests: true }))
  .use(live())
  .listen(3000);

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

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
Nib

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
  bold-button()

.bold-alternate
  bold-button(glow: #00ABFA)

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

Capsule

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
apps

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.