Live data from Hacker News

Our First Node.js App: Backbone on the Client and Server

nerds.airbnb.com

21–30 of 69 posts

Re: Our First Node.js App: Backbone on the Client and Server

#21
It's worth pointing out that DerbyJS already renders on the server and the client without any configuration. I implore you all to give it a shot.

For an example, visit http://phishvids.com – try clicking around and then refreshing or even disabling javascript.

[0] http://derbyjs.com

Re: Our First Node.js App: Backbone on the Client and Server

#22

I was lucky to be able to catch a preview presentation of this "Holy Grail" project at SpainJS, last summer. It's very interesting stuff. I think that one of the more important caveats to mention is that to the extent that your application is composed of rich interactions, visualizations and interactivity, and logged-in-user-only content, that stuff tends to remain on the client-side alone ... but for your basic rend…

The cool part is that Rendr builds a backbone hierarchy around server generated HTML, attaching the rich interactions after the page has been displayed. Although, if the user starts to interact before that view hierarchy has been constructed, for example by clicking on links, the behavior won't be "rich". (However that would require some fast clicking!)

The author (spikebrehm) speaking here - that's a good observation! It's possible that the user will click on a link before the JS finishes downloading. Luckily, we've taken care to use real URLs for all links, and our pages render fully on the server as well, so if they click before the Backbone views initialize, they will fall through to the server. Not the fastest experience, but still fine at the end of the day.

Re: Our First Node.js App: Backbone on the Client and Server

#24

Earlier quoted context omitted.

The cool part is that Rendr builds a backbone hierarchy around server generated HTML, attaching the rich interactions after the page has been displayed. Although, if the user starts to interact before that view hierarchy has been constructed, for example by clicking on links, the behavior won't be "rich". (However that would require some fast clicking!)

The author (spikebrehm) speaking here - that's a good observation! It's possible that the user will click on a link before the JS finishes downloading. Luckily, we've taken care to use real URLs for all links, and our pages render fully on the server as well, so if they click before the Backbone views initialize, they will fall through to the server. Not the fastest experience, but still fine at the end of the day.

Cool! I think it's a reasonable assumption for rendr to make, since using "real" URLs is a best practice regardless!

Re: Our First Node.js App: Backbone on the Client and Server

#25

I was lucky to be able to catch a preview presentation of this "Holy Grail" project at SpainJS, last summer. It's very interesting stuff. I think that one of the more important caveats to mention is that to the extent that your application is composed of rich interactions, visualizations and interactivity, and logged-in-user-only content, that stuff tends to remain on the client-side alone ... but for your basic rend…

Author here (spikebrehm):

Jeremy, I think you're mistaking this for Keith Norman's SpainJS presentation (http://www.youtube.com/watch?v=jbn9c_yfuoM). He proposes the same approach, but I don't know if it ever got past a demo. Although it seems like they may be using some form of this at Groupon in production.

Anyway, it is exciting, isn't it? This is just the beginning for us -- we've had to make a few hacky design decisions to be able to ship, but I think we will get the kinks worked out. The trick, and the challenge, seems to lie in choosing the right set of abstractions to hide the code complexity from the application developer. I hope to open source it as soon as I can, to benefit from the input of luminaries such as yourself!

Oh yeah, and the offer to give a Tech Talk at Airbnb next time you're in SF still stands :)

Re: Our First Node.js App: Backbone on the Client and Server

#26

This is really interesting, although I'm still new enough to node and complex JS apps that I'm struggling to take it all in. That being said, could a hack-ish approximation of what Airbnb is doing be accomplished by rendering the first call of an app in phantom.js and pushing it out in the response stream? Questions about session state management are popping up in my head but maybe that's some of the secret sauce in…

Author here (spikebrehm). Good question. Yep, you could accomplish something similar by booting up PhantomJS or node-chimera [0] and scraping yourself, but that seems hacky and hard to scale. Justin Tulloss of Rdio talked about this approach in his Airbnb Tech Talk [1], saying that the tricky part is determining when the page is actually done rendering, especially if you have a bunch of JavaScript that's performing DOM manipulation.

[0] https://github.com/deanmao/node-chimera [1] https://www.youtube.com/watch?v=TB-l2nF67iU

Re: Our First Node.js App: Backbone on the Client and Server

#27
post #21

It's worth pointing out that DerbyJS already renders on the server and the client without any configuration. I implore you all to give it a shot. For an example, visit http://phishvids.com – try clicking around and then refreshing or even disabling javascript. [0] http://derbyjs.com

Major shout out for phishvids :)

I'd love to help with the transition to Redis if I get some free time in the near future, assuming you're still looking to go that route.

Re: Our First Node.js App: Backbone on the Client and Server

#28
post #27
post #21

It's worth pointing out that DerbyJS already renders on the server and the client without any configuration. I implore you all to give it a shot. For an example, visit http://phishvids.com – try clicking around and then refreshing or even disabling javascript. [0] http://derbyjs.com

Major shout out for phishvids :) I'd love to help with the transition to Redis if I get some free time in the near future, assuming you're still looking to go that route.

[deleted]

Re: Our First Node.js App: Backbone on the Client and Server

#30

This is exactly what I've been waiting for. I can't wait til this is open-sourced! Was just thinking about trying out Angular because Backbone just wasn't cutting it, but this is going to make me hold out. Random piece of feedback: it's weird to use data-model_id (instead of data-model-id). I assume you're trying to match some pre-existing naming convention (but JS tends towards camelCase anyways...), but I think it…

[deleted]
Post reply on HN