Airbnb Open Sources Rendr, A Library For Running Backbone.js Apps On Both Client And Server

Airbnb today announced that it is open sourcing Rendr, its library for running Backbone.js apps seamlessly on both the client and the server. After launching its Chronos cron replacement a few weeks ago, this marks the company’s second major contribution to the open source ecosystem this year. Airbnb originally developed Rendr for its mobile site.

A few months ago, Airbnb talked about how it started using Node.js to bring its listing to users. To provide a good, fluid user experience, Airbnb’s Spike Brehm said at the time, more and more of the application logic for many apps has now moved to the client. The company itself previously took this approach by using Backbone.js and Rails. This, however, means the application logic is then “somewhat arbitrarily split between client and server, or in some cases needs to be duplicated on both sides.” It also, the Airbnb team argues, poses challenges when it comes to SEO, performance and maintainability because the app is then divided into at least two different codebases – and both of those are likely in different languages.

airbnb_nerd_logoBut what if you could have a JavaScript runtime on the server? Then, Brehm wrote, you could “pull most of this application logic back down to the server in a way that can be shared with the client,” developers could just focus on writing application code and the app could serve up real HTML on first pageload, which is great for SEO reasons. To make this possible, the company developed Rendr.

Rendr, Airbnb says, allows your web server to serve “fully-formed HTML pages to any deep link of your app, while preserving the snappy feel of a traditional Backbone.js client-side MVC app.” You can find out more about the technical details behind Rendr here and in Airbnb’s original post about the project.

The team says Rendr is already ready for production-quality apps and while Airbnb hopes that it will become more modular over time and maybe even decouple it from Backbone to allow it to work with other client-side MVC libraries, it doesn’t intend for it to become the next Ember.js or Backbone.js.