Realtime, reactive web apps without Javascript using Stimulus Reflex

Thought you guys would be interested in this.

Stimulus Reflex lets you build realtime, reactive apps in Rails similar to Phoenix LiveView. You don't have to write any Javascript and it will use Rails to render all the HTML updates server-side. It uses ActionCable to trigger updates and then tells Rails to render the current page again and send that back over the websocket. It'll then use DOM diffing to update the page automatically for you.

Definitely one of the coolest projects going on right now in the Rails world I'd say. It looks like we might see some similar things in Turbolinks 6 when that comes out too which is exciting.


3 thoughts on “Realtime, reactive web apps without Javascript using Stimulus Reflex”

  1. Seems really promising, I’d love to find out more about performance on “heavier” pages.

    E.g. consider a page that pulls in content from 100s of records from a few related models and does a bit of processing to display these in a complex way. Perhaps I want to add a checkbox to enable or disable one of those records. With UJS I can perform a very lightweight AJAX request and render a small erb.js partial that will reflect that change on the frontend.

    If I understand stimulus reflex correctly, it would re-render the whole page, send that down the pipe and then only the diff of the HTML would be rendered. So you would be spending time performing new active record queries to load the page and then spending time rendering the views when the final HTML change might be changing a piece of text and adding a class.

    Does anyone have any real world insights on SR performance in this kind of context?

  2. Having recently built a project with Stimulus for the first time after years of working with React/Vue/etc, I’m really enjoying it. It feels like building Rails apps did a decade ago, which is roundabout the time I abandoned UJS in favor of what we then called “client-side MVC.”

    I’m really excited to try out Stimulus Reflex in my next project. Has anybody paired it with [AnyCable](

    I’ve been developing Rails apps since 2006, and it definitely feels like we’re on the cusp of something special, again. I run a small software shop with my wife. As she told me yesterday, “you’re always happier when you’re working in Ruby.” It feels good to be home. 🙂

  3. I can’t guess the difference with Turbolinks right now, but I’ll dive into the docs to understand. Looks promising 🙂


Leave a Comment