frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Local First Htmx

https://elijahm.com/posts/local_first_htmx/
48•srid•9h ago

Comments

oldestofsports•5h ago
HTMX is neither a meme nor is it anti-javascript, it is literally written in js.

It does not aim to remove js from your code, it simply adds more features to HTML by default, like making any element able to trigger an web request.

When you write a real world app with HTMX, you inevitably end up writing some js, which is totally fine.

sublinear•5h ago
Why not just write the js yourself? It's really not that complicated. The people who keep pushing for htmx are weird.
Swizec•5h ago
> Why not just write the js yourself? It's really not that complicated. The people who keep pushing for htmx are weird.

HTMX is great. We use it as a middle ground for mildly interactive parts of the app. Places where jquery/vanilla would get annoying but going full React isn’t worth it. Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive.

Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time.

Extra bonus: it encourages you to write small self-contained composable endpoints instead of massive kitchen-sink pages.

Culonavirus•2h ago
> Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive. Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time.

Yes. Then imagine you have a massive legacy codebase and a control panel of something has a ton of data and buttons and inputs and all kinds of nonsense. Say you have a weight and dimensions of a package of a product... you'd like to make it so you can edit these in-place and when you do, a package volume (and/or volume sum of all packages) gets updated somewhere else on the page (along with some other info... I don't know, an estimate of product delivery cost based on volume, which delivery methods are now un/available etc.)

Like... you already have ways to calculate and show these in your server side logic. With HTMX you reuse these, add a sprinkle of hx-get and add some OOB updates and you're done. You can do the same with ajax, but not nearly as fast as with HTMX and much more annoyingly...

righthand•5h ago
Because with HTML you get static, non-flashing, intstantly rendered without load times. So smart developers actually want less Javascript, because the browser already implements most of what Javascript does, why reinvent the wheel?

Why would I write React components myself when I the Javascript isn't really that complicated?

It is bizarre that ONLY HTMX gets these weird "DONT USE THAT ITS NOT POPULAR ENOUGH" criticisms.

XML, XLST get these criticisms except for the XQuery and XPath components because HTML fanatics need that to make their hybrid HTML/JS garbage apps work.

But really the ultimate goal for any good website engineer should be to offload as much logic and processing to the browser, not rewrite everything in JS just because you can.

orhmeh09•5h ago
> But really the ultimate goal for any good website engineer should be to offload as much logic and processing to the browser, not rewrite everything in JS just because you can

Why? This makes for a horrible user experience. Things like TicketMaster, and in recent years GitHub, slow my machine to a crawl sometimes. I much prefer mostly static content. This is a well-made website: https://www.compuserve.com/

johannes1234321•4h ago
Which isn't JavaScript's failure per se. I wouldn't wat to use a Google Maps like thing, with full page reload each time I scroll or zoom or check details of a place.

The issue is of "plain" websites for bad reasons add dynamic stuff.

on_the_train•4h ago
Because I don't know js and don't want to touch it
HiPhish•4h ago
Why should I write it myself? Sure, I could do that, but then every time I want to have that sort of functionality on multiple pages I would have to write the JavaScript code multiple times. I could then roll it into a library. Maybe make the library work with custom HTML attributes. And now I've just reinvented HTMX. So I might as well use HTMX instead of reinventing it.

Such a weird question. You could ask that about any library ever.

Animats•3h ago
Nor is it "local first". It works by remotely pushing HTML into the DOM. It's really a form of push technology.
kryptn•3h ago
htmx isn't local first. this blog post is about trying to make it 'local first' by introducing a service worker.
xg15•3h ago
It is definitely "anti-javascript" or more precisely "anti-SPA". I've read the blog posts.
zelphirkalt•3h ago
JS != SPA though, no matter how many frontendies want to believe it is equivalent.
brabel•2h ago
It’s funny to equate JS with SPA. We’ve had JS on the web since day 1 to add interactivity to otherwise static pages. SPA only became a thing decades later.
oldestofsports•1h ago
Sorry but you must have read with your eyes closed. Here’s a quote from the HTMX website:

”After all, both htmx and hyperscript are built in JavaScript. We couldn’t have created these libraries without JavaScript, which, whatever else one might say, has the great virtue of being there.

And we even go so far as to recommend using JavaScript for front-end scripting needs in a hypermedia-driven application, so long as you script in a hypermedia-friendly way.

Further, we wouldn’t steer someone away from using JavaScript (or TypeScript) on the server side for a hypermedia-driven application, if that language is the best option for your team. As we said earlier, JavaScript now has multiple excellent server-side runtimes and many excellent server-side libraries available.”

https://htmx.org/essays/hypermedia-on-whatever-youd-like/

recursivedoubts•27m ago
htmx is pro-JavaScript:

https://m.youtube.com/watch?v=9ZhmnfKD5PE

It is not anti-SPA, but pro-hypermedia for the right problems:

https://htmx.org/essays/when-to-use-hypermedia/

htmx is a front end library of peace

kryptn•2h ago
i decided to use htmx for a frontend for myself and it was a pretty fun experience. even got tailwind involved pretty easily with my rust+maud backend.
cubefox•1h ago
> HTMX is neither a meme nor is it anti-javascript, it is literally written in js.

Java is written in C++, but it is clearly "anti-C++" for any reasonable interpretation of the term. (Java historically replaced C++ as the most popular language, as far as I remember.)

More importantly, HTMX could have had native support without requiring an implementation in JavaScript.

recursivedoubts•5m ago
we are working towards incorporating some of its ideas into the html spec:

https://alexanderpetros.com/triptych/

righthand•5h ago
The WASM component just seems like a way to avoid writing models? Or is it demonstrating that you can run your server in the browser? Why is WASM needed then if it's just handling simple internal requests. WASM adds a layer of Golang which would be nice if the server needed to be portable from the local, but then why run the server locally at all if you need it in remote contexts? If you're trying to build a simple local JS app, why not just write it all in JS?
mattrighetti•57m ago
WASM is not needed.

The author explicitly states that he likes to write Go and that’s why he picked it in this example, which in my opinion makes this article more interesting. The main benefit is that the 'local server' within the service worker mimics the 'real server,' which effectively means you only have to write the code once.

But I generally agree that a 10MB download on first load is not something that I’d be happy to serve to users, especially to those who are using their mobile network.

aidenn0•5h ago
So far, all of the comments are taking this far too seriously. It's literally just: "htmx is supposed to be great" and "Local first is supposed to be great" so lets combine them in the dumbest way possible.
librasteve•2h ago
Really enjoyed this article … thanks for opening my mind wider.

In case anyone thinks this idea is serious, my strong like of vanilla HTMX came from the realizations that (i) state management can revert to the ur-web model and avoid all the complexity of browser / server state synch and (ii) I can use anything I damn well like on the server (I wrote https://harcstack.org to optimize for expediency).

kubafu•2h ago
Big fan of htmx here, so thanks for opening my eyes to a new way of using it with service workers.

But man, 10MB Go WASM download? That's a no go. It's not only about downloading it but executing on a clients machine over and over again. But I guess you can handle those requests perfectly fine just in service worker using pure JavaScript.

pickpuck•57m ago
I built something with Service Workers a few years ago. It's similar in concept, but I never got around to syncing with a server.

Instead of a WASM backend, I used react-dom/server to generate the HTML.

https://github.com/michaelcpuckett/listleap?tab=readme-ov-fi...

Valdi – A cross-platform UI framework

https://github.com/Snapchat/Valdi
296•yehiaabdelm•11h ago•102 comments

Making Democracy Work: Fixing and Simplifying Egalitarian Paxos

https://arxiv.org/abs/2511.02743
43•otrack•3h ago•1 comments

Why is Zig so cool?

https://nilostolte.github.io/tech/articles/ZigCool.html
350•vitalnodo•12h ago•248 comments

Becoming a Compiler Engineer

https://rona.substack.com/p/becoming-a-compiler-engineer
234•lalitkale•13h ago•103 comments

Friendly Attributes Pattern in Ruby

https://brunosutic.com/blog/ruby-friendly-attributes-pattern
27•brunosutic•5d ago•12 comments

Myna: Monospace typeface designed for symbol-heavy programming languages

https://github.com/sayyadirfanali/Myna
280•birdculture•17h ago•134 comments

Immutable Software Deploys Using ZFS Jails on FreeBSD

https://conradresearch.com/articles/immutable-software-deploy-zfs-jails
85•vermaden•11h ago•31 comments

How to find your ideal customer, right away

https://www.reifyworks.com/writing/2023-01-30-iicp
48•mrbbk•4d ago•4 comments

How did I get here?

https://how-did-i-get-here.net/
225•zachlatta•15h ago•43 comments

Why I love OCaml (2023)

https://mccd.space/posts/ocaml-the-worlds-best/
334•art-w•21h ago•243 comments

Ruby Solved My Problem

https://newsletter.masilotti.com/p/ruby-already-solved-my-problem
230•joemasilotti•16h ago•91 comments

Local First Htmx

https://elijahm.com/posts/local_first_htmx/
48•srid•9h ago•25 comments

Running a 68060 CPU in Quadra 650

https://github.com/ZigZagJoe/Macintosh-Q650-68060
48•zdw•10h ago•18 comments

YouTube Removes Windows 11 Bypass Tutorials, Claims 'Risk of Physical Harm'

https://news.itsfoss.com/youtube-removes-windows-11-bypass-tutorials/
648•WaitWaitWha•14h ago•239 comments

A rats to riches story: Larry the Downing Street cat finds place in TV spotlight

https://www.theguardian.com/politics/2025/nov/08/a-rats-to-riches-story-larry-the-downing-street-...
10•zeristor•1h ago•1 comments

Apple's "notarisation" – blocking software freedom of developers and users

https://fsfe.org/news/2025/news-20251105-01.en.html
111•DavideNL•5h ago•57 comments

Venn Diagram for 7 Sets

https://moebio.com/research/sevensets/
133•bramadityaw•4d ago•33 comments

Reverse Engineering a Neural Network's Clever Solution to Binary Addition (2023)

https://cprimozic.net/blog/reverse-engineering-a-small-neural-network/
3•Ameo•4d ago•0 comments

Angel Investors, a Field Guide

https://www.jeanyang.com/posts/angel-investors-a-field-guide/
143•azhenley•18h ago•31 comments

How a devboard works (and how to make your own)

https://kaipereira.com/journal/build-a-devboard
71•kaipereira•12h ago•28 comments

Transducer: Composition, abstraction, performance (2018)

https://funktionale-programmierung.de/en/2018/03/22/transducer.html
97•defmarco•4d ago•5 comments

Ribir: Non-intrusive GUI framework for Rust/WASM

https://github.com/RibirX/Ribir
67•adamnemecek•15h ago•11 comments

FSF40 Hackathon

https://www.fsf.org/events/fsf40-hackathon
88•salutis•5d ago•2 comments

VLC's Jean-Baptiste Kempf Receives the European SFS Award 2025

https://fsfe.org/news/2025/news-20251107-01.en.html
364•kirschner•14h ago•66 comments

Show HN: Find matching acrylic paints for any HEX color

https://acrylicmatch.com/
24•dotspencer•4d ago•11 comments

GPT-OSS 120B Runs at 3000 tokens/sec on Cerebras

https://www.cerebras.ai/blog/openai-gpt-oss-120b-runs-fastest-on-cerebras
12•samspenc•8h ago•3 comments

James Watson has died

https://www.nytimes.com/2025/11/07/science/james-watson-dead.html
316•granzymes•15h ago•188 comments

Can you save on LLM tokens using images instead of text?

https://pagewatch.ai/blog/post/llm-text-as-image-tokens/
22•lpellis•6d ago•8 comments

Helion: A high-level DSL for performant and portable ML kernels

https://pytorch.org/blog/helion/
140•jarbus•6d ago•47 comments

Shell Grotto: England's mysterious underground seashell chamber

https://boingboing.net/2025/09/05/shell-grotto-englands-mysterious-underground-seashell-chamber.html
26•the-mitr•4d ago•14 comments