News for hackers. Stuff that matters.
Re:We've Open-sourced Rendr by pbiggar on Friday April 19, 2013 @12:38PM (#5577484)
I'm not sure I fully understand this, is this just for SEO? Why not run the page in phantomJS, which is what we do at https://circleci.com, and what meteor apps do, and any others?
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @12:51PM (#5577549)
SEO was our first concern, but then we realized performance was the big win. Serving the user a full page of HTML rather than waiting for JS to download before rendering HTML makes a big difference, especially on high-latency or low-bandwidth connections (mobile).

EDIT: We decided against using something like PhantomJS or node-chimera because why deal with a DOM if you don't have to? DOM is complicated and slow, compared to string-based templating. Plus, it's another moving part, another process to keep up and running. The Meteor guys aren't too excited about the PhantomJS approach either, and IIRC they'd like to be able to serve HTML without firing up a DOM.

Re:We've Open-sourced Rendr by msoad on Friday April 19, 2013 @12:56PM (#5577567)
Does this mean Rendrjs applications will run in a JavaScript disabled browser? That would be a big win!
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @01:02PM (#5577605)
Yep! Because links use full URLs which get intercepted by JavaScript, if JS is disabled, you can still navigate around the app, getting full HTML from the server. Of course, any client-specific code wouldn't run (slideshows, etc).
Re:We've Open-sourced Rendr by jonny_eh on Saturday April 20, 2013 @02:31AM (#5580551)
So far, this is the most convincing argument I've heard for Rendr.
Re:We've Open-sourced Rendr by bilalq on Sunday April 21, 2013 @01:28AM (#5583975)
I'm a little confused here. Maybe I'm just not seeing it, but how does that make Rendr any different from any other server-side framework that responds with HTML?
Re:We've Open-sourced Rendr by WickyNilliams on Sunday April 21, 2013 @01:23PM (#5585509)
Because you're using the same JavaScript code for rendering on either the client or the server.
Re:We've Open-sourced Rendr by aristus on Friday April 19, 2013 @02:18PM (#5577959)
How do you measure performance? I'm interested specifically in where & how you instrument, and how you collect the data.
Re:We've Open-sourced Rendr by pbiggar on Friday April 19, 2013 @01:27PM (#5577739)
Cool stuff, thanks for the response!
Re:We've Open-sourced Rendr by bfirsh on Saturday April 20, 2013 @06:17AM (#5580959)
Or Zombie, which is way faster than PhantomJS: https://github.com/bfirsh/otter
Re:We've Open-sourced Rendr by wsc981 on Friday April 19, 2013 @12:09PM (#5577340)
Posts like this makes me think Airbnb is a awesome place to work. Sharing is caring!
Re:We've Open-sourced Rendr by malandrew on Friday April 19, 2013 @03:06PM (#5578189)
I want to see them start open sourcing more of their i18n and translation tools. Most people aren't aware of this, but one of the coolest problems you can work on at AirBnB is building out tools and features that let two people, who don't speak a common language between them, transact with one another. There is no other startup I know of as vested in solving this problem.
Re:We've Open-sourced Rendr by ajacksified on Friday April 19, 2013 @03:44PM (#5578347)
Indeed! We've started with polyglot.js[0], an i18n helper for Node.js and client-side javascript, but there's definitely a lot going on besides this.

[0] https://github.com/airbnb/polyglot.js

Re:We've Open-sourced Rendr by untog on Friday April 19, 2013 @02:02PM (#5577886)
It's great to see AirBnb's open sourced work, and tech talks, etc. Kudos to them - I'm sure it helps a lot with recruiting. I used to work for a company in a similar space and looked to AirBnb with deep envy.
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @02:15PM (#5577946)
Re:We've Open-sourced Rendr by untog on Friday April 19, 2013 @02:47PM (#5578091)
Luckily for me it has been a long time since I was in that situation. Anyone would be wise to check that page, though- fantastically designed.
Re:We've Open-sourced Rendr by jaredmcateer on Friday April 19, 2013 @03:59PM (#5578423)
My girlfriend's brother works there. Based on what I've heard from him, I'm pretty jealous, but she's worried if I worked there I'd never come home.
Re:We've Open-sourced Rendr by bru on Friday April 19, 2013 @11:34AM (#5577176)
Fourth link on the page links to http://nerds.airbnb.com/github.com/airbnb/rendr-app-template (which obviously does not work) instead of http://github.com/airbnb/rendr-app-template
Re:We've Open-sourced Rendr by ssorallen on Friday April 19, 2013 @11:49AM (#5577253)
Indeed it does. Thanks for the heads up, we'll change that.
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @12:48PM (#5577535)
Thanks, fixed.
Re:We've Open-sourced Rendr by j_s on Friday April 19, 2013 @12:27PM (#5577433)
Re:We've Open-sourced Rendr by seanconaty on Friday April 19, 2013 @02:25PM (#5577989)
Anyone interested in something like this should also check out PJAX. Push State and AJAX. https://github.com/defunkt/jquery-pjax

This is what GitHub uses between tabs on its Pull Requests page. I love how simple the implementation is.

Your app still needs to follow the convention of having links going to different pages with URLs. I know it's not "single page" and the interaction is not that "rich." But it's nice because all your logic is still on the server, all rendering and templates are on the server and the server responds with either a full page of HTML or a partial page of HTML depending on an HTTP header you set.

Oh yeah, it also works without Javascript, crazy!

Re:We've Open-sourced Rendr by ricardobeat on Friday April 19, 2013 @02:57PM (#5578140)
That is how Backbone and all other current frameworks work.
Re:We've Open-sourced Rendr by superfreek on Friday April 19, 2013 @08:14PM (#5579300)
No it isn't.
Re:We've Open-sourced Rendr by ricardobeat on Friday April 19, 2013 @10:20PM (#5579661)
Care to explain? They use pushState or hashes for routing, and load data via XHR. If you are using pushState it is assumed that the URL must exist on the server.
Re:We've Open-sourced Rendr by cheapsteak on Saturday April 20, 2013 @01:37AM (#5580430)
Having the URL exist on the server isn't the same as serving a rendered page from the URL, which is what most SPAs do. You could just rewrite all URLs in a website to point back to your index.html, then have the client side router initialize the app from the URL parameters. If you don't have javascript turned on (e.g. googlebot) then all you'll see is a blank page
Re:We've Open-sourced Rendr by ricardobeat on Saturday April 20, 2013 @01:23PM (#5582116)
Googlebot interprets javascript. In that case you shouldn't use pushState but fragment URLs[1].

I should have said it is assumed that the URL exists on the server and points to the same resource/content; otherwise setting URLs using pushState makes no sense. GitHub is a good example of how it should be done, not an exception.

[1] https://developers.google.com/webmasters/ajax-crawling/docs/...

Re:We've Open-sourced Rendr by d0m on Friday April 19, 2013 @01:33PM (#5577772)
Just wondering what's the difference between this post and the last one where Rendr was already open-sourced? I mean, it was already open sourced for a while. Is there a change log or an adapter to better integrate with other systems? Thanks!
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @03:09PM (#5578202)
At the time of the previous post, Rendr was not yet open-sourced.
Re:We've Open-sourced Rendr by avodonosov on Friday April 19, 2013 @02:14PM (#5577942)
The big change is that I missed the previous post, but noticed this one :)
Re:We've Open-sourced Rendr by csulmone on Friday April 19, 2013 @12:40PM (#5577500)
Wow, looks very impressive from my quick look over it.

These days, there are so many JavaScript frameworks for web development, it's starting to make my head spin a little bit.

Does anyone have a link to a good rundown of where everyone stands?

Re:We've Open-sourced Rendr by fatbat on Friday April 19, 2013 @05:46PM (#5578857)
What do you mean by "where everyone stands"?

I agree that there are so many JS libs/frameworks now that it is hard to keep up with! I actually started on a super simple script for myself to compare git repos general stats.

Re:We've Open-sourced Rendr by dualogy on Friday April 19, 2013 @02:01PM (#5577883)
> Does anyone have a link to a good rundown of where everyone stands?

Well, even if I had one, it would be outdated in 2 weeks..

Re:We've Open-sourced Rendr by liveaxle on Saturday April 20, 2013 @12:42AM (#5580262)
Being a JS developer must be the pits - you need to run really fast just to keep up.
Re:We've Open-sourced Rendr by wilmoore on Sunday April 21, 2013 @10:01PM (#5587354)
...you need to run really fast just to keep up.

This is exactly the part of being a JS developer that is appealing :)

Re:We've Open-sourced Rendr by jedschmidt on Friday April 19, 2013 @04:50PM (#5578649)
This is an awesome solution for folks using Backbone and who don't mind a tight framework coupling.

But if you're not on Backbone, or don't want to add another constraint to how your app is built, it's pretty easy to set up your own PhantomJS server; I presented on this very topic at TXJS this week[1], and created a library[2] that makes it a snap to set up.

[1] http://www.flickr.com/photos/tr4nslator/sets/721576332659462...

[2] https://github.com/jed/rndr.me

Re:We've Open-sourced Rendr by don_draper on Friday April 19, 2013 @12:28PM (#5577438)
Are there any similar efforts to tie the server with the client, reducing duplication, for Angular?
Re:We've Open-sourced Rendr by davej on Friday April 19, 2013 @01:03PM (#5577608)
Angular uses DOM templating instead of string-based templating (most current JS templating engines are string-based), so you would definitely need to fire up a headless browser (PhantomJS) or DOM (JSDOM) of some sort to get it working.

It would be very slow if you were doing this dynamically so you would probably want to regularly compile and cache your pages.

Some links on this topic: https://github.com/steeve/angular-seo http://www.yearofmoo.com/2012/11/angularjs-and-seo.html

Re:We've Open-sourced Rendr by jameswyse on Friday April 19, 2013 @03:04PM (#5578175)
Yeah this is the best way to serve rendered pages to search engines. I also found this project: https://github.com/ithkuil/angular-on-server - Which might be worth looking at too.
Re:We've Open-sourced Rendr by csmatt on Friday April 19, 2013 @12:38PM (#5577480)
The first thing I thought of that is similar to Rendr is http://meteor.com/ . I'm not sure about how it works with Angular. It does describe itself as a framework where Rendr describes itself as a library, so I'd think it'd be easier to run Angular stuff on top of Rendr.
Re:We've Open-sourced Rendr by jjsz on Friday April 19, 2013 @01:42PM (#5577807)
There's also hoodie + yeoman, but there aren't any adapters for angular yet. For some reason angular doesn't get official love from libraries like rendr and meteor.
Re:We've Open-sourced Rendr by ksec on Friday April 19, 2013 @12:33PM (#5577458)
so they have completely ditch Rails and Ruby?
Re:We've Open-sourced Rendr by apendleton on Friday April 19, 2013 @12:40PM (#5577497)
I don't work there, but I doubt it. With rendr, both the client- and server-side portions of the Backbone stack still need to consume an upstream API. If I had to guess, I'd say that for projects they're building that use this stack, all the templating/rendering/presentation logic is in JS, but that the database interaction stuff probably isn't; they probably have Rails apps that expose a RESTful API that the rendr apps consume.
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @12:50PM (#5577541)
This is exactly right. We still have 5 years worth of business logic in Rails, so we just expose a RESTful API as part of the Rails app. The same API is consumed by our iOS, Android, Mobile Web, and Desktop clients.
Re:We've Open-sourced Rendr by fuddle on Friday April 19, 2013 @01:37PM (#5577793)
Cool stuff, very interesting concept, would love to see an example working with a Rails RESTful API.
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @01:44PM (#5577819)
The app template is such an example, consuming the public GitHub API: https://github.com/airbnb/rendr-app-template

In the future, we'd like to come up with some more in-depth tutorials.

Re:We've Open-sourced Rendr by fuddle on Friday April 19, 2013 @02:01PM (#5577879)
Great thanks I'll take a look at it again, I seen the "Interacting with a RESTful API" section in the wiki left blank and assumed it was in the pipeline.
Re:We've Open-sourced Rendr by adamnemecek on Friday April 19, 2013 @01:46PM (#5577822)
IIRC, they are using node.js and rendr for their mobile site and still use Rails for the main website.
Re:We've Open-sourced Rendr by frontendbeauty on Friday April 19, 2013 @02:16PM (#5577949)
We're using Rendr in a few more apps in production, in progress. It's starting to eat away at our Rails site a bit.
Re:We've Open-sourced Rendr by ameyakarve on Saturday April 20, 2013 @05:27AM (#5580872)
Could there be a feature to run the app logic on the client when a connection is not available? Else, it can fallback to the server. This will help a lot when it comes to offline support
Re:We've Open-sourced Rendr by msoad on Friday April 19, 2013 @12:58PM (#5577577)
IS IT FASTER?

I assume Node/JavaScript will render HTML faster than ruby/rails. Do you have benchmarks?

Re:We've Open-sourced Rendr by tracker1 on Friday April 19, 2013 @04:13PM (#5578479)
Node/JS won't necessarily render HTML faster. There are libraries to bring DOM interaction into NodeJS, there's also PhantomJS, and previous attempts like Aptana's server. All of these have been very heavy, and didn't scale well. PhantomJS is probably the best current option, but doesn't tie directly to Node, and still not as fast as string based templating.

Regarding string based templates, they are really implementation dependant, and there are tons of options available. Right now some common ones for NodeJS are probably Bliss (Razor inspired), Nunjucks (jinja2 inspired), Mustache/Handlebars and Jade (Haml inspired), and EJS (similar to PHP, or classic ASP).

Probably the most broadly available is Mustache, which has implementations in about every language under the sun, and probably could make a decent benchmark to compare string processing in different languages.

All of the above simply bring me, to use what you feel comfortable with and what feels right.

Re:We've Open-sourced Rendr by ricardobeat on Friday April 19, 2013 @03:05PM (#5578180)
Faster than what? V8 can be an order of magnitude faster than Ruby: http://benchmarksgame.alioth.debian.org/u32/benchmark.php?te...
Re:We've Open-sourced Rendr by JPKab on Friday April 19, 2013 @11:20AM (#5577092)
Awesome. Looking forward to checking this out.