Build reactive applications with the Rails tooling you already know and love

What is StimulusReflex?

StimulusReflex is a new way to craft modern, reactive web interfaces with Ruby on Rails.

We extend the capabilities of both Rails and Stimulus by intercepting user interactions and passing them to Rails over real-time websockets. These interactions are processed by Reflex actions that change application state. The current page is quickly re-rendered and the changes are sent to the client using CableReady. The page is then morphed to reflect the new application state. This entire round-trip allows us to update the UI in 20-30ms without flicker or expensive page loads.

This architecture eliminates the complexity imposed by full-stack frontend frameworks without abandoning high-performance reactive user experiences. With StimulusReflex, small teams can do big things faster than ever before. We invite you to explore a fresh alternative to the Single Page App (SPA).

Get Involved. We are stronger together! Please join us on Discord.

GitHub stars GitHub forks Twitter follow

New (PRE)Release: v3.4 - Developer Happiness Edition

NOTE: This beta documentation for the pre-release of v3.4. All of the new features below are only accessible if you are helping us test.

Developer happiness is not a catch-phrase. We are actively working to improve the quality of life for the 10,000 people downloading StimulusReflex every week, because happy developers enjoy a great surplus.

As with all major StimulusReflex releases, v3.4 is packed full of new features from 52 contributors that are directly inspired by the questions, requests and grievances of the 800+ people on the SR Discord:

  • we completely overhauled the client-side Reflex logging with per-Morph granularity

  • a brand new and shockingly customizable server-side Reflex colorized logging module

  • a new finalize life-cycle stage that occurs after all DOM mutations are complete

  • support for lazily evaluated signed and unsigned Global ID to model instances

  • a special cable_ready method that automatically broadcasts to the current user

  • speaking of CableReady, the new v4.4 means operation and broadcast method chaining

  • an optional (but recommended) "tab isolation" mode to restrict Reflexes to the current tab

  • major improvements behind the scenes to better handle (many) concurrent Reflex actions

  • StimulusReflex library configuration courtesy of our new initializer system

  • automatic support for mirroring DOM events with jQuery events, if jQuery is present

  • JS bundle size drops from 43kb to 11.1kb - including CableReady, morphdom and ActionCable

More than anything, StimulusReflex v3.4 feels fast and incredibly solid. We didn't take any shortcuts when it came to killing bugs and doing things right. We owe that to our users as we use our surplus to build the world we want to live in, together. 🌲


v3.3 introduced the concept of Morphs to StimulusReflex.

Page Morphs provide a full-page morphdom refresh with controller processing as an intelligent default.

Selector Morphs allow you to intelligently update target elements in your DOM, provided by regenerated partials or ViewComponents.

Nothing Morphs provide a lightning-fast RPC mechanism to launch ActiveJobs, initiate CableReady broadcasts, call APIs and emit signals to external processes.

There's a handy chart showing how the different Morphs work. Find all of the documentation and examples behind the link below.

Why should I use StimulusReflex?

Wouldn't it be great if you could focus on your product instead of the technical noise introduced by modern JavaScript? With StimulusReflex, you'll ship projects faster, with smaller teams and re-discover the joy of programming.


  • Enable small teams to do big things, faster 🏃🏽‍♀️

  • Increase developer happiness ❤️❤️❤️

  • Facilitate simple, concise, and clear code 🤸

  • Integrate seamlessly with Ruby on Rails 🚝

Faster UIs, smaller downloads and longer battery life

Our over-the-wire JavaScript payload size is a tiny 11.1kb gzipped... and that includes StimulusReflex, ActionCable, morphdom and CableReady.

While StimulusReflex is a radically different approach that makes it hard to do a direct comparison to the popular SPA frameworks, the one thing everyone seems to agree on is how small their Todo List implementation is. Here's the numbers:


Wire Size











Not everyone has the latest iPhone in their pocket. We're delivering HTML to the client, which every device can display without a framework rendering a UI from JSON. We reduce complexity for developers while making it easier for people with slower connections and less-powerful devices to access your site without draining their battery.

Live demo

StimulusReflex Expo is a growing collection of like examples showing different use-cases alongside the source code behind them.

Some of our favorite demos include:

  • Tabular: filtering, sorting and pagination without any client JavaScript

  • Todo: our take on the classic, with a wire size 2-15x smaller than every other solution

Build the next Twitter in just 9 minutes (or less) 😉

First-class ViewComponent support

When you have ViewComponent installed in your project, you can use componentized views in your Reflexes without any configuration required. 💯

If you install the amazing ViewComponentReflex as well, you will be able to persist the state of your components into the user's session. Every instance of your components will maintain their own local state. This provides seamless continuity for your UI - even when doing full-page Reflex updates. Hand, meet glove. 🖐️+🧤

Some things just have to be seen: check out the ViewComponentReflex Expo for live demos.

How we got here

We love Rails. Veterans of the framework remember the feeling of awe and disbelief after seeing David Heinemeier Hansson's Build a Blog in 15 minutes video. It didn't seem possible that web development could be so easy, productive, and fun. We're talking exponential gains in developer efficiency and happiness. Rails has become so successful that nearly every framework since has borrowed ideas, patterns, and features from it.

The landscape has changed a lot since those early days. Applications are more ambitious now. The pursuit of native UI speeds spawned a new breed of increasingly complex technologies. Modern Single Page Apps have pushed many of the server's responsibilities to the client. Unfortunately this new approach trades a developer experience that was once fun and productive for an alternative of high complexity and only marginal gains.

There must be a better way.

The revolution begins

In his 2018 ElixirConf keynote, Chris McCord (creator of the Phoenix framework for Elixir) introduced LiveView, an alternative to the SPA. His presentation captures the same promise and excitement that Rails had in the early days.

We love Elixir and Phoenix. Elixir hits a sweet spot for people who want Rails-like conventions in a functional language. The community is terrific, but it's still small and comparatively niche.

Also, we just really enjoy using Ruby and Rails.

StimulusReflex was originally inspired by LiveView, but we are charting our own course. Our goal has always been to make building modern apps with Rails the most productive and enjoyable option available. We want to inspire our friends working with other tools and technologies to evaluate how concepts like StimulusReflex could work in their ecosystems and communities.

So far, it's working! Not only do we now have 20+ developers actively contributing to StimulusReflex, but we've inspired projects like SockPuppet for Django.

We are truly stronger together.