When I first learning about code. I never really interested with frontend. It seem clunky and hard compared to writing code for backend.

At the beginning (this is 2008, I’m still not very interested in coding) I only knew fact that HTML is the structure, CSS is the style, and JS is the logic. Three of this create the foundation of web as we know it.

Then I leave the web development and doesn’t really touch it at all for many year. I learn to write Python and C# (only on Unity) for university year, but I never really touch on web development again. Even as I learn Java on my work, web development become my Achilles heel because I only knew how to write backend code. I don’t like that, it feel like a huge hole in my skillset.

So bit by bit, I start to learn write frontend code.

React

Just like everyone, I have heard about React even when I don’t know anything about Frontend. I pictured it as the best way to write anything that can be seen by the user, basically everyone use it and not using it is the same as not having job on Frontend at all.

Honestly, at the time I don’t understand why React is nice. I was busy reading Stack Overflow on how to useState and useEffect. As long as my button is working and text is changing immediately on the screen then I am happy.

Looking back, starting with React maybe was a mistake. It crystalize decades of Frontend developer experience into a single framework. It hide all the pain that was faced that make React as it is.

React require us to build our project. It convert our ‘simple’ code into a bunch of HTML and JS that may not be readable for us. That is not an issue since browser able to read this code and serve it on the screen. This whole build process is my biggest joy and pain in React. It allow us to add dependency quickly and easily and it does help, very helpful.

I was content with this for a long time, accepting that this is the best and the only way to write browser in modern way.

It take a while for me to get comfortable writing React since its not my main job.

Not long after that I start to question a few thing:

  • Why we write JS for everything?
  • Why Frontend ecosystem have brand new framework every year or so?
  • Why node-modules is so big?
  • Why is it so hard to upgrade the dependency version?
  • Why we had so many styling library?
  • Why people even bother to use JS on backend?
  • Why sometime we need nginx to deploy our web?

Then I found out about htmx

HTMX

I find out about htmx when browsing on lobste.rs, first time reading it I was really intrigued by the twitter account. It feel weird seeing an official htmx account posting memes on twitter.

Then I start to learn a bit more about the library itself. I immediately was taken by the idea. HTMX allow us to ‘go back to the root’, back to writing only html, something that weirdly absent when writing React.

I’m not sure how to describe htmx, it allow us to replace a html element with another html from an API response. This require us to create another type of API on backend, an API that will return html, not json, but a html. People already discover the perfect combo for this by the time I start to trying it.

HTMX + Tailwind + Alpine.js with Go Templ or Python Django

This combo allow us to write a complete webpage with only the necessary part. A total turn away from the usual node driven world of React.

Granted, later on I found some issue with this, but I like it.

This allow us to create a very simple and very small application that only do what we need and nothing more. I never though I can deploy a complete application in <50MB, but here we are.

For a while, this is my biggest and the best way to create web for me.

At the time, I also start to explore many other tool on backend side and a lot of programming language, getting perspective from many side. Something that not easy to find in world of pre-AI.

When I ask myself, can everyone use this? I found myself answering no, I already accept that most people don’t really care about the bleeding edge tech, they just want to finish their job and go home. Using this stack at work seem to risk this a lot. People, at least the one I work with, will not care and they will require time to adjust to this new stack, Not to mention the risk if they do okay with it. So I only use this for my personal project.

One thing I miss from using HTMX is the inability to not have static type. I still prefer the idea of typescript. Adding it mean that I will require to re-add node back to the project, one thing I’m not willing to do just yet.

Eventually I do try to add it. Adding Vite and npm on top of it next to a Go Templ folder, I think its kind of a cursed setup.

Astro.js

Learning about many perspective make me realize what people has been saying for ages. There is no silver bullet, there is only compromise.

I like htmx, but I think it was a walk too far, too wishful in modern age.

People do need web component, they still need typescript, they still need npm.

Then I find Astro, my latest discovery for now.

I like Astro approach, it doesn’t lean too far into React side and doesn’t lean too far to HTMX side. It located on a good spot, a just right compromise.

I kind hate that I miss the ability to deploy everything on a single repo, but it is much easier to develop and manage. It also come with typescript and allow us to attach React as needed.

Now, I’m still obsessed writing a web without any framework, I still like it barebone. Learning css without tailwind is indeed a challenge, but I like it. Also learning many type of html tag I never heard of is also an exploration i like.

Astro enable me to still had this ability while knowing that I can React whenever I want without having to commit only to choose one side.


Maybe in the future I will update this writing with a simple demo. For now this is all. I knew in the future I will find a new shiny framework and I still glad to learn it and at least learn their perspective on issue.

I only hope, in the future people don’t have to jump all this hoop to learn the best way to write a web application the way they like it. I knew the necessary evil that require us to do all of this. But I have a wishful thinking that everything can be simpler someday.