Hotwire

Description

Hotwire is the Rails solution for building interactive UIs without too much javascript. Our usage of Hotwire in Astra consists of Turbo and Stimulus.

When building UIs using Turbo, we strive to organize routes and pages like it is 2005-meaning simple server side rendered pages and RESTful routes. We enhance this with Turbo Frames and Turbo Streams to make the application feel more like a modern web application, allowing multiple interactions on a single page. For example, when a modal opens, its content is fetched from a dedicated endpoint. A Turbo Stream then renders the HTML inside the modal without requiring a page navigation.

We use Stimulus controllers for additional client side interactivity. Ideally these controllers are reusable across the app. For example, a shared controller for copying data to clipboard on click. We’ve also found page specific controllers to be useful for particularly complex pages.

We broadcast Turbo Streams from background jobs for slow or data-intensive form submissions. This enables safely processing data while keeping sensible timeouts for most web requests.

Technology Status at Wunder

Adopt. This is our preferred technology for building interactive UIs.