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).
Enable small teams to do big things, faster 🏃🏽♀️
Increase developer happiness ❤️❤️❤️
Facilitate simple, concise, and clear code 🤸
Integrate seamlessly with Ruby on Rails 🚝
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:
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.
Some of our favorite demos include:
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.
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 much 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.
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.