rails/learn
Hotwire in Real Rails Code
Mid-level Rails devs know the Hotwire syntax. The senior gap is knowing where Hotwire stops working as a default and what to reach for next. Six lessons, anchored in shipping production code from Basecamp, HEY, and Mastodon.
Read these in order if you are new to Hotwire. The first three (Streams, Frames, Optimistic UI) cover the patterns you reach for daily. The last three (Stimulus boundary, morphing, when not to reach for Hotwire) cover the calls that separate mid from senior.
Lesson 1
Walkthrough
Turbo Streams vs Broadcasts
Hotwire has two transport channels. Most teams reach for ActionCable when an inline stream would do. The render-and-broadcast pattern keeps them from stepping on each other.
Lesson 2
Walkthrough
Lazy-loaded Turbo Frames
Frames with a src attribute load independently. The dashboard pattern: eight widgets, each in its own frame, slow ones never block fast ones.
Lesson 3
Walkthrough
Optimistic UI without state management
The like-button shape. Update the DOM client-side, fire the request, reconcile via stream. Where this works, where it does not, and why Hotwire users do not need Redux.
Lesson 4
Walkthrough
The Stimulus boundary
When a Stimulus controller is the right tool, when it is not. The rule of thumb: if state has to live somewhere other than the DOM, you are past Hotwire's sweet spot.
Lesson 5
Walkthrough
Turbo morphing in Rails 8
What changed with morph mode, when to morph vs replace, and the gotchas around focus, scroll position, and form state that catch teams on first contact.
Lesson 6
Walkthrough
When NOT to reach for Hotwire
Rich text editors, drag-and-drop with persistent state, multiplayer collaboration, offline-first. Where you graduate to Inertia or a real framework. Knowing this is the most senior part.