Less JavaScript in Web Development

There are several libraries that are getting attention from web developers because they are trying to go back to the simplicity of having a backend and a frontend when building web applications.

There is a crazy belief that small companies and startups must follow the software development trends set by Facebook, Google, Amazon, Microsoft, and other big tech companies. But these companies are solving different problems than the rest of the world. Not many applications are like Google Workspace, Microsoft Office (web), or Figma. Most applications in general just require CRUD with some business logic.

Most of us don’t need the complexity that modern front-end frameworks bring. Unfortunately, developers are creating simple websites with the same tools used by large companies to solve very complex problems. I have seen code that replicates native HTML elements just for the sake of working with React. A simple page that could be done with some native HTML, CSS, and some sprinkles of JavaScript, becomes an endless inception of nested divs. It is time to stop the madness we are creating for ourselves.

As somebody who teaches web design and web development, I can tell that students are struggling to understand new frameworks because most of them are creating components from scratch. Few frontend frameworks are using web technologies as building blocks to creating web pages or web applications. I mean, you tell people to learn HTML, CSS, and JavaScript to later say forget everything you learned, because the way to create websites is with components.

Of the modern web frameworks, Svelte is the one I like the most because the way components are made uses the same mental model of making traditional web pages. So, students don’t have to relearn a lot of things before they are productive with the framework. The same applies to Junior developers because the transition from other frameworks is smooth as creating a svelte file is a component that contains basically plain HTML, CSS, and JavaScript.

In general, we are overcomplicating things for ourselves. Most websites don’t need to be created with React or even a frontend framework at all. For the majority of websites, HTML, CSS, and some JavaScript is sufficient. But we have the obsession of using a frontend framework just because we can. For a while now, the browser has become an operating system on its own that must run megabytes of JavaScript and be responsive. We need to do better!

The good news is that I see a trend happening that wants to reduce the JavaScript sent to the client and instead of getting JSON from the server, it gets ready constructed HTML to insert into places on the page. This brings us back to when we started using Ajax in the past because the server becomes the only source of truth and we don’t have to manage state in the browser to be synchronized with the server. In addition, it makes JavaScript more unobtrusive as it was used in the past by allowing HTML elements to do their job and only JavaScript takes over when needed.

Over 10 years ago, I worked on a project that required a music player to keep playing the music while the user navigated to different pages. It was done with jQuery and some unobtrusive JavaScript that enhanced the navigation of the entire site. But jQuery or vanilla JavaScript was not the experience.  Something similar is what is done now by replacing only the elements needed when users perform an action on an element.

I would like to invite you to explore htmx and Unpoly so you can see that there is light at the end of this craziness of 10 years of JavaScript. With these libraries, I feel that the mental model of how to create web applications becomes simpler and it is easier to communicate between cross-functional teams. Moreover, you avoid the tooling that is required by modern web frameworks. The more tools and frameworks we use, the more points of failure and complexity are added to the application.  With htmx and Uponly, just add a small file to the head of the page, and you are set to go. I am not saying that you don’t need React, Vue, and Angular. I am referring that for most projects, you just might need htmx or Unpoly to create great UX without selling your soul to one framework. There is no better developer experience than not having to install or run anything for development.

Teylor Feliz
Teylor Feliz

Teylor is a seasoned generalist that enjoys learning new things. He has over 20 years of experience wearing different hats that include software engineer, UX designer, full-stack developer, web designer, data analyst, database administrator, and others. He is the founder of Haketi, a small firm that provides services in design, development, and consulting.

Over the last ten years, he has taught hundreds of students at an undergraduate and graduate levels. He loves teaching and mentoring new designers and developers to navigate the rapid changing field of UX design and engineering.

Articles: 182