HeadlinesBriefing favicon HeadlinesBriefing.com

µJS: 5KB AJAX Library Outperforms HTMX and Turbo

Hacker News •
×

A developer has built µJS, a 5KB JavaScript library that offers AJAX navigation without the complexity of HTMX or the overhead of Turbo. The library intercepts link clicks and form submissions, fetching pages in the background and swapping only changed content. This creates instant navigation without full page reloads.

µJS requires no framework learning, build steps, or server-side changes. Users add a single script tag and call mu.init() to transform any site. It works with any backend including PHP, Python, Ruby, Go, and Node.js. The library includes features like prefetch on hover, built-in progress bars, and patch mode for updating multiple fragments.

The project emphasizes simplicity with its single 5KB gzipped file and zero dependencies. It supports modern features like the View Transitions API, DOM morphing via idiomorph, and Server-Sent Events for real-time updates. Quick setup involves adding two script tags to existing HTML pages.