Hotwire. Making the front end fun again?
Remember coding a static HTML site by hand? That’s how I got started. It was fun and easy to build a website because they were so simple. Now they are getting pretty complex.
Single page apps that talk to an API-only backend can get you some pretty impressive results but also suck more and more the bigger they get. The problem with having more frontend features is that it comes at the cost of drastically increasing complexity.
Users (and bosses) want very intricate, stick frontend apps that will impress. While the programmers often want to simplify it down and keep code debt manageable. Make it an easy crud app. Or better yet a static HTML file. Tired of client-side JavaScript single-page apps and all the headaches it brings? And the logic required makes a mess of your code. Hotwire fixes this.
Hotwire’s magic comes in 3 parts.
- Turbo offers an alternative approach to dividing a page into components and streaming updates as HTML partials over WebSocket.
- Stimulus has been with us for a while now. It aims to “sprinkle” your front-end with javascript-enabled behavior while not requiring a full single-page app.
- Strada (not out at the time of this writing) plans to simplify the connection between the web and native apps. This should make native apps backended by web app easier to build.
All this means a return to a simpler yet more productive development experience. It allows you to keep your template rendering on the server without sacrificing the responsiveness and speed of traditional SPAs. It also means small teams can compete more easily and it makes the front end fun again.