The Road to V1

TL;DR Stop over complicating your life. Use Datastar.

It’s been a long time since I wrote an essay on the site. Part of the reason is that the project overall was done in my head, and was “good enough” for my needs. A while back, Carson Gross prompted me to give a talk at Utah.js, and I later appeared as a guest on the HX-Podcast to talk about why everyone has been doing web development wrong – especially me. I put out a call for help before calling it V1, and man, the response was overwhelming.

That was all before the PHP nation attacked.

There have been people that come in with their own itch and want changes to Datastar, which makes perfect sense. But all of a sudden, I’m getting PHP devs really interested, including an early contributor to htmx. I don’t think of PHP as a real-time language, so if Datastar works for their needs as well as my real-time focused project, I must be doing something right.

It’s been a maelstrom of activity the last month or so. The entire codebase has been rewritten twice. That might seem silly, but it’s all about what assumptions you’re making. It’s no surprise that I dislike TypeScript and loathe JavaScript, but they are the only game in town (WASM doesn’t count yet). Through the rewrites, I’ve gone from a prisoner of the constraints to trying to thrive in them. It’s a very weird feeling, but I’m actually proud of the codebase now. Looking at it, it seems obvious in a way that only hindsight can provide.

Some of the highlights of the changes since the last essay:

The crazy part to me at this point is trying to understand why this hasn’t already been done in other projects. I’m not a JS wizard like Evan You, Ryan Carniato, or Rich Harris. I’m just a guy that felt like the way we make front end was WAY overcomplicated. The more I work with this codebase, the more I think we all threw the baby out with the bathwater when it comes to hypermedia. Put state in the right place, and it’s a lot easier to reason about.

Datastar originally was my attempt to combine the parts of htmx and Alpine I liked theoretically, but not in practice. For me, it was a library that allowed you to make your own framework. At this point, I think it’s a lot more than that. It’s changed the way I think about front-end development as a whole. I’m very confident that it can do ANYTHING that React, Vue, or Svelte can do, faster and with less code. I’ll take on anyone that disagrees; it’s the model that makes the browser do what it’s best at. It’s fast, robust, and easy. There is still performance work that can be done, but the overall approach is solid.

Now that the rewrite is done, I can’t wait to get back to boring. In my experience as the person with the most Datastar code out there, it’s pretty awesome that actual Datastar work is % of any project. You just hook up a few bindings and events and get back to the real work. I’m excited to get back to making things that matter instead of fighting with the tools.