Let’s face it, nowadays, even the most complex web development tasks are expected to be written in JavaScript. Having said that, the consistently changing landscape of JavaScript is confusing and makes productivity difficult. And it is not as if JavaScript is the most user friendly language in the world. JavaScript is as popular as it is because it has always been a necessary evil in frontend web development.

However, there was a time where JavaScript only existed to be sprinkled into your frontend to make it feel more dynamic. In recent years, in a search for perceived performance, large corporations began writing the crux of their applications in JavaScript in the frontend. This considerably shrunk the requirements for backend work in these applications. It is no secret that many smaller companies and individuals followed suit. Applications, after a long initial load, now seemed to be much faster than before.

Lately, there has been a trend to render JavaScript in the backend for performance and SEO purposes mainly (in the same way HTML has been rendered in the backend previously with MVC frameworks). This had me wondering if it would be possible to completely bypass rendering HTML using JavaScript and return to the more simple backend MVC pattern Ruby on Rails boasts.

The challenge is that Ruby on Rails does not currently provide a good alternative to frontend frameworks. Inevitably, more and more companies will have to convert their Ruby on Rails applications into APIs to create a better UX if this does not change. StimulusJS is the only player trying to provide such an alternative, but it still forces you to write a lot of application logic in JavaScript and converts your views into huge messes as a store for their state.

What if I told you there exists a Ruby on Rails frontend framework that will allow you to cut most of your application’s dependency on frontend JavaScript? And on top of that, it allows you to continue writing your views in ERB while easily managing the user’s state! Well, it does exist and its name is fie.

fie is a Rails-centric frontend framework running over a permanent WebSocket connection. It allows you to use your controller’s instance variables as a state that is shared between your frontend and backend. it also includes a ton of cool features such as manipulators and pools which I will explain in future articles (but you can read about in the guide until then). To illustrate how easy fie is to get started with, I built a simple slideshow which I will walk you through below.