[Blog Series] The Lost Arts of CLJS Frontend

12 Likes

Thank you very much for the article and for creating shadow-cljs, which we use everyday and made ClojureScript way more accessible.

The article also helped a to get a better understanding of shadow-graft. I share your opinion that the island architecture plus small parts of ClojureScript are more powerful than htmx.

I’m doing web development since 2004 starting with Java Server Pages. Since then web development was reinvented countless times. Everyone seems to be trapped in an endless circle of reinventing the wheel. At the moment we are at a stage were more things are moved to the server again.

I’m tired of the fact that deciding what approach to use for your next project is still an ongoing research topic. With the advent of React or rather Reagent, it felt like: cool, that code can stay like this the next 30 years or more. However, nowadays I’m fighting with the problems of our bloated SPA :sweat_smile:

While learning htmx I had the feeling: maybe the code can really stay the same forever. Since htmx is only adding a bare minimum to the core mechanics of traditional web applications. Therefore we started to use htmx for the less complex pages, also to put our SPA on a diet.

While I’m watching a whole talk to only get what React Server Components has to offer. Pieter Levels continues to earn millions per year with his SaaS platforms that he wrote with jQuery and PHP. He scaled one platform to 1 million ARR using a single large PHP file on a single virtual private server :smile:

I’m not planning to switch to PHP and jQuery :sweat_smile: But Pieter inspires me to search for ways to be less distracted by technical details to have more time to provide value to your customers. And htmx might be a good chance to do this.

3 Likes

Absolutely.

I have many years of PHP in my own history, and in some regards it still remains unmatched in its simplicity of getting something up and running quickly. Of course I’d never use it again, but at some point I hope to write something in CLJ that gets close to that simplicity. The setup in CLJ is still far too complicated.

It is also important to not forget that react isn’t all there is. There are many other very popular things in the world, they just don’t happen to be easily usable from CLJS. So it sometimes appears as if react was the sole dominant victor in the world, when it absolutely isn’t. RSC and this whole mixing frontend/backend code (e.g. "use server") seems absolutely ridiculous to me, and a million times more complicated than PHP+jQuery.

1 Like

It’s entirely possible to create a php grammar and runtime using GitHub - zcaudate/foundation-base: core libs. There is already a JS grammar and runtime.

As the follow up:

@zcaudate1 I wasn’t serious about PHP as a platform. I’d never touch that ever again. Just the time to “hello world” is pretty much unparalleled and something to strife for.

2 Likes

Thanks to taking the time to write both of these up! Great to hear a Clojure native and Web native perspective on how to get the benefits of htmx. I do not have 25 years of experience working on web software, so I wouldn’t know how to approach the problem without tools like shadow.graft or htmx.

1 Like

php is a pretty awesome target because of zend and all the stuff done by facebook to make it super fast. it’s actually not that hard to create the grammer. i’m using luajit for the backend but php is even simpler. the js grammer also contains jsx generation which couple be modified for php templates

Finished writing the third and (probably) final post of the series.

3 Likes

great series - though I’m not sure if there was ever a “michaelangelo of cljs” to ever learn the ‘lost arts’ from. It could even be titled “the art of the dom”. I didn’t actually see much proper cljs code runnable on the jvm in there. It’s all interop that is being talked about and it may be better off doing some sort of lispy js rather than buy into the kitchen sync, immutability as default approach.

From a personal perspective, the third post did resonate with me. The sunk cost fallacy is real as I took a long time dealing with the consequences of building my tooling around datomic. However, good work is never wasted and I can say that I’m a much better programmer for it.

my question to the author would be: what’s next after lisp enlightenment?

I don’t know how to answer that, since I do not believe in the premise.

CLJS and CLJ are tools for me. I hope that my series conveyed that I believe in choosing the right tool for the job. For me personally they are very flexible tools and given their host interop capabilities cover a broad spectrum of use cases that fit my requirements perfectly. If I had different needs I might chose different tools in a heartbeat. Paredit certainly ruined other syntaxes for my, but that is hardly Enlightenment.

I’m glad to hear it - the ‘realisation’ I was talking about was the fact that no matter how awesome a lisper one is, there is going to be someone more talented writing js.

I do think programming/tool making is a slow plodding journey and hopefully what I’m doing will come full circle at some point. Best thing about running in this race is to watch and interact with all the other winners along the way.