Node.js: Express, Socket.io, and everything LearnBoost

This post is part of a series of articles about my recent experience building Sled using Node.js.

Express It

There wasn’t much of selection 6 months ago when I started coding Sled when it came to Node frameworks. Node itself provides very little. You create an HTTP server and get a callback when a new HTTP request comes in. Modern web applications require session management, request routing, and view rendering at the very least. These functions are provided by frameworks.

At the time, the only two popular frameworks were Connect and Express. Connect provides a basic middleware framework with some built-in facilities such as a static file server, route management, cookie parser, form-encoded and JSON-encoded body parser, and logging. Express, built on top of Connect, adds a much more robust routing facilities, view rendering and other goodies. I’m not doing these frameworks justice with this descriptions.

I use Express extensively and it is fantastic.

Express’ biggest asset is its maintainer, TJ Holowaychuk. I have seen first-hand how Express grew and matured into a stable and powerful framework. Express made it easy for me to write the application server used for login, registration, account management, and other static assert (developer pages, about) with very little extra effort. If you are going to develop a traditional web application in Node, you should probably start with Express.

I plan to open source some of the additional functionality I’ve added on top of Express to validate request bodies and query parameters, a flexible authentication configuration facility for routes, and a light layer to make it easier to building API servers. Given my focus on OAuth, I’m going to share my OAuth + Express experience in a followup post.

Express really shines when you combine it with Jade, another brilliant brainchild of Mr. Holowaychuk – a simple templating language for HTML which is easy to learn, easy to read, and unlike all the rest, doesn’t suck. We had to restrain ourselves from converting some static HTML files into Jade because once we started using it, we didn’t want to read actual HTML ever again.

Socket.io is Magic

Really!

I am willing to bet that a large percent of those taking a look at Node for the first time are doing it because of a Socket.io -powered demo they have seen. Socket.io provides a trivial-to-use server and client library for making real-time, streaming updates between a web server and browser client. It makes building cool real-time games a matter of hours, and it works on every crappy browser known using the best available option from Flash to WebSockets.

We use Socket.io to power Sled’s real-time features which include live updates to your shared list as changes are made. To put this in perspective, it took us one day to add real-time streaming updates to the API server, and another day or two to add it to the client. So in three days we got full, real-time updates going between multiple browsers. What used to be months of work when Google Docs was first introduced, is now trivial with Socket.io.

So yeah, it’s magic.

Socket.io comes from Guillermo Rauch and the team of superstars at LearnBoost. There are days when I have to wonder if these guys get anything done for their own startup, given the amazing open source projects they push out on a weekly basis. I’m bummed that I’m not the target audience for their product because looking at the technology it must be amazing. I consider them part of the Sled team, given just how much of their code we are using.

In fact, I appreciate their work so much, I’d like to get a small fundraiser going to send these guys to dinner or whatever else they feel like doing for fun. I hope you join me in showing our appreciation. Without their continued work and dedication, Node would be an amazing platform that is just too raw to use.

Thanks to Blaine Cook for the idea.

7 thoughts on “Node.js: Express, Socket.io, and everything LearnBoost

  1. Thanks for posting this. TJ and the LearnBoost team deserve so much respect and appreciation for these amazing projects. Fundraiser is an excellent idea – I’m happy to have a way to show my gratitude.

  2. As one of the only non-technical people at LearnBoost, I can honestly say that these guys are like magicians. It’s a pleasure and an honor to see them do what they do, and it’s awesome to see them getting some love from the dev world!

  3. +1 I couldn’t agree more
    I’m continuously blown away by the great code/tools that learnboost crew are producing.

  4. Express is a great framework even though it is just a thin layer on top of Connect, it is intuitive and abstracts a bunch of request/response functions!

Comments are closed.