Hotwire / Turbo

Turbo is part of the Hotwire system from the developers of Ruby on Rails. It's not reliant on Rails and will work with other backend frameworks. It does a lot and using Rails definitely helps get the most of out it.

Turbo Drive came from the previous Turbolinks iteration. It speeds up the overall feel of site by performing request via AJAX and replacing the HTML on the page. It's pretty brute force, but doesn't require much integration.

Turbo Frames builds on the HTML Iframe paradigm. Actions taken within an turbo-frame tag expect the response to have a turbo-frame tag with the same Id. It then swaps out the HTML inside the frame tags. You can target other frames or the top frame (page). This is also done via AJAX requests.

Turbo Streams, by default use AJAX requests with a custom mime type. They also support websockets and SSEs for broadcasted updates. The response from a turbo stream request is expected to set a turbo stream content type header and provide HTML fragments wrapped in turbo-stream tags. Those tags tell Turbo where and how to update the HTML.

There is additional support for creating Native iOS & Android applications, which I haven't explored yet.

This sounds like a lot going on, and it is, but a lot of boilerplate code will go away with the next version, Turbo 8. I've integrated Turbo into a number of applications and it creates a responsive UI that's easy to understand and develop.

Subscribe to WebDev news from candland.net

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe