[](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/) [](https://codeclimate.com/github/hopsoft/stimulus_reflex/maintainability) # StimulusReflex ### Build reactive [Single Page Applications (SPAs)](https://en.wikipedia.org/wiki/Single-page_application) with [Rails](https://rubyonrails.org) and [Stimulus](https://stimulusjs.org) This project supports building [reactive applications](https://en.wikipedia.org/wiki/Reactive_programming) with the Rails tooling you already know and love. It's designed to work perfectly with [server rendered HTML](https://guides.rubyonrails.org/action_view_overview.html), [Russian doll caching](https://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching), [Stimulus](https://stimulusjs.org), [Turbolinks](https://www.youtube.com/watch?v=SWEts0rlezA), etc... __No need for a complex front-end framework. No need to grow your team or duplicate your efforts.__ --- > The lifecycle of a "modern" SPA app is so convoluted, it requires a team to build and support. > The wire size and computation demands of these heavy client sites frequently run slower than the server-rendered pages that they replaced. > With Stimulus Reflex, a Rails developer can build Single Page Applications without the need for client rendering or heavy JS frameworks. --- _Inspired by [Phoenix LiveView](https://youtu.be/Z2DU0qLfPIY?t=670)._ 🙌 ## How it Works 1. Render a standard Rails view template 1. Use [Stimulus](https://stimulusjs.org) and [ActionCable](https://edgeguides.rubyonrails.org/action_cable_overview.html) to invoke a method on the server 1. Watch the page automatically render updates via fast [DOM diffing](https://github.com/patrick-steele-idem/morphdom) 1. That's it... __Yes, it really is that simple.__ There are no hidden gotchas.  ## Setup ### JavaScript ``` yarn add stimulus_reflex ``` ### Gemfile ```ruby gem "stimulus_reflex" ``` ## Basic Usage ### app/views/pages/example.html.erb ```erb
Increment <%= @count.to_i %>