What is StimulusReflex?
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.
Why should I use StimulusReflex?
- ✅ Enable small teams to do big things, faster 🏃🏽♀️
- ✅ Increase developer happiness ❤️❤️❤️
- ✅ Facilitate simple, concise, and clear code 🤸
- ✅ Integrate seamlessly with Ruby on Rails 🚝
New Release: v3.5
Find out more and learn how to upgrade on the Release History page.
Faster UIs, smaller downloads and longer battery life
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.
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.
Build the next Twitter in just 9 minutes (or less) 😉
This demo from early 2020 is exciting, but it is not a tutorial!
First-class ViewComponent support
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. 🖐️+🧤
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.