News for hackers. Stuff that matters.
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by stanfordkid on Saturday March 07, 2026 @06:23PM (#47292468)
I'm curious to understand, why would you build your website this way vs. say jQuery. I've never really understood the HTMX ecosystem. Is this just to avoid javascript and replace that with html pages, id's and attributes? It feels like the DOM is a very clear abstraction and scripting is a more powerful way to manipulate it. What do people like or prefer about this approach and paradigm?
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by amaury_bouchard on Saturday March 07, 2026 @07:21PM (#47292939)
The target audience is developers who are efficient at generating HTML server-side using an MVC framework, a template engine, whatever they're comfortable with. Instead of building a JSON API and a JavaScript layer to consume it, you just return HTML fragments from your existing routes.

µJS handles the AJAX call and swaps the fragment in the DOM. No JavaScript to write, no state to manage client-side. jQuery is more powerful and flexible, but that flexibility comes with complexity: you have to write the fetch call, handle the response, find the right DOM node, update it.

µJS does all of that declaratively via HTML attributes. It's not for every use case — highly interactive apps (think Google Maps or a rich text editor) still need proper JavaScript. But for the vast majority of web pages, server-rendered HTML fragments are simpler, faster to develop, and easier to maintain.

Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by freakynit on Saturday March 07, 2026 @10:28PM (#47294099)
What happens when a user lands directly on 2nd or 3rd level page and have not "jumped" from 1st level page?
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by vbernat on Saturday March 07, 2026 @11:15PM (#47294339)
The idea is that all the rendering is done server-side. So, the user always get a full page.
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by freakynit on Saturday March 07, 2026 @11:49PM (#47294495)
Hmm, got it. Thanks..
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by hwhshs on Sunday March 08, 2026 @01:33AM (#47295099)
I feel like the browser should just do the same thing and this not be needed. E.g. seemless reload, keep scroll and focus state etc.
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by amaury_bouchard on Sunday March 08, 2026 @07:38AM (#47296537)
Nothing special happens. µJS doesn't change anything for direct URL access. The server renders the full page as usual. µJS only intercepts navigation once it's initialized on the page. This is actually one of the advantages of this approach over a true SPA: every URL is a fully server-rendered page, so direct access, bookmarks, and sharing links all work out of the box.

Let's take an example. Say we have a website with 3 pages:

- Homepage "website.com/"

- Products "website.com/products"

- About "website.com/about"

Your browser can load any of these pages directly, as usual. But when you are on the homepage (for example) and you click on the "About" link, µJS load the "/about" URL, and replace the current page's `<body>` tag with the fetched page's one.

It's that simple.

Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by freakynit on Sunday March 08, 2026 @11:29PM (#47304578)
Got it.. thanks..
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by logicprog on Saturday March 07, 2026 @06:40PM (#47292590)
I think the idea is that it's completely declarative, and the range of what you can do, being constrained to a set list of operations and targets, becomes clearer and easier to understand?
Re:Show HN: µJS, a 5KB alternative to Htmx and Turbo with ze... by lofaszvanitt on Sunday March 08, 2026 @04:31AM (#47295627)
JS ecosystem is bonkers. Do not look for logic where there is none.