Turbolinks 5 is a library for web applications that makes pages load faster. Here’s how:
- When the user navigates, it replaces only the body of the page (and merges the headers) with AJAX, instead of doing a full page load
- If the user navigates to a page that they’ve already viewed in that session, it displays a cached version and then checks for new content in the background
These features make your app appear at least 2x as fast to the user.
Even from Spain with 125ms ping time, Turbolinks changes most Basecamp 3 pages in <300ms vs ~900ms in a normal click. (X-Runtime ~ 120ms)
— DHH (@dhh) March 1, 2016
Turbolinks’ genius is that delivers the improved user experience of a client-driven app without you having to write a client-driven app.
Consider it, every time
You should strongly consider Turbolinks 5 for any new Rails project.
I didn’t consider previous versions of Turbolinks. Superficially, they seemed buggy. Turbolinks 5 is a full rewrite, and it’s been running swimmingly in production for Basecamp 3 and my little project, TourExec.
Why consider Turbolinks now?
Because your users deserve the fastest possible experience, and you deserve to ship quickly.
When I built TourExec, a tour booking platform, I wanted an excellent booking experience for customers. Simply, they choose a time and how many they are, and the app displays available times. Then, hopefully they click a time and book.
Notice in the interaction there is no page reload. The user chooses a date, and the times dynamically update. When the user clicks a time, the booking form appears almost instantly.
This is the most advanced implementation of Turbolinks in my app. The rest of its benefits apply without any extra work.
My admin interface for businesses is super snappy, thanks to Turbolinks. At the point of sale with a line of customers waiting, a business benefits from a tour roster that loads in a third of the time.
I pull in React for some particularly interactive features, like a schedule builder that lets businesses define their tour times. In that case, it was easier to write React components than figure out a server-driven approach that delivered an acceptable experience.
Too often, frameworks like React grow to take over an entire application without a true analysis of the pros and cons.
In the case of TourExec, Turbolinks delivers a speedy experience throughout, and I bring in React for particular needs. This balance allows us to move quickly and reduces technical debt down the road.