Here I will demonstrate how you will save more than 50% of you budget using Hotwire instead of JS libraries like React. Having all cool aspects of a smooth modern App.
SPA is acronym for Single Page Application. These are applications which doesn’t reload full page, but only parts of the page giving to the user a smoother feeling, and not losing focus in page. This opens the door to create Mobile Native Apps based on these libraries (like React Native).
Main problem of these SPA modern applications (with React, Vue, Angular…) is that they increase a lot the complexity of web applications by needing a JSON API server and Frontend application, triplicating your systems and human resources.
Rails solves this smartly by sending its traditional HTML partials to be replaced in the browser by Turbo.js, based on the HTML tag information. So you are saving on complexity, development costs and number of developers. And promoting happiness for your developer!!!
Hotwire is divided in two packages Stimulus and Turbo. At the same time Turbo is divided in Drive, Frames and Streams:
- Turbo Drive solves the turbolinks approach by replacing the HTML body with the response of GET or POST calls to the server, instead of reloading full page. Giving to Rails views SPA-feeling without any development cost. Also manages gratefully the browser cache problem in SPA applications.
- Turbo Frames goes a step further by replacing page fragments. The clue here is to generate html partials in server, and replace these in view.
- Turbo Streams goes further by using ActionCable to use Websockets, creating a live-feeling in your app by broadcasting html partials to different users when info is changed in server.
Solving this part, you can also use Turbo to create Mobile Native Apps with turbo-android and turbo-ios.