Carson Gross ships htmx 4 and leaves npm's default alone
The eight-month rewrite moves htmx from XMLHttpRequest to fetch, adds streaming and morphing, and keeps version 2 as npm's default until 2027.
By RuntimeWire Staff · Published
Primary source: htmx
Why it matters
htmx 4 expands the server-rendered HTML model without using a major release to force migration. Gross is betting that careful compatibility and boring deployment choices will keep htmx useful longer than a faster upgrade cycle would.

Carson Gross, the Montana State University professor who created htmx, released htmx 4.0.0 on August 28 after eight months of work on the JavaScript library. The release replaces its XMLHttpRequest-based internals with the browser's fetch API, adds built-in morphing and streaming features, and changes several behaviors that had accumulated since htmx's intercooler.js origins.
Gross is giving developers time to absorb those changes. htmx 4 is available through package managers and CDNs, but it will remain under npm's next tag until early 2027. htmx 2 will retain the latest tag because non-versioned CDN links could otherwise pull the major upgrade into production applications without their owners choosing it.
That decision captures Gross's approach to the release. htmx 4 expands what the library can do without turning a major version number into an adoption deadline. The announcement says htmx 2 will remain supported indefinitely and tells users they should feel no pressure to migrate.
A rewrite that tried to preserve the old behavior
Gross began considering htmx 4 while building fixi, a smaller library that gave him more experience with fetch and asynchronous JavaScript. Christian Tanul then approached him with ideas for streaming HTML, according to the release, giving Gross a practical reason to replace the older request layer.
Gross recruited Michael West and Alexander Petros, and the group started by porting fixi alongside the existing htmx test suite. Their rewrite gradually moved closer to htmx 2 as the contributors encountered the reasons behind earlier design decisions. Gross said the behavioral differences between the two major versions are now relatively small.
The internal switch to fetch should be invisible to most developers. It gives htmx a cleaner base for extensions, including server-sent events, WebSockets and multipart streaming. Christian Tanul, a core contributor whose public GitHub profile credits him with htmx's improved real-time integrations and new <hx-partial> element, led the streaming and live-extension work.
Michael West improved and integrated the morphing algorithm that Gross originally developed as idiomorph. Morphing lets htmx reconcile returned HTML with the existing document instead of bluntly replacing a target, which can preserve state and reduce disruption during updates. The new <hx-partial> element gives servers a clearer way to send several targeted document updates in one response.
htmx 4 also introduces preload and download extensions, compatibility helpers for Alpine.js, and hx-live, a small scripting layer influenced by Alpine, jQuery and hyperscript. An htmax.js distribution bundles htmx with frequently used extensions for developers who prefer one package.
The migration cost sits in the HTML
The most consequential breaking change is explicit attribute inheritance. htmx 2 allowed attributes on parent elements to affect descendants automatically, a behavior inherited from intercooler.js and modeled loosely on CSS. It was concise and sometimes difficult to trace.
In htmx 4, developers must add an :inherited suffix when they want that behavior. A confirmation attached to a parent, for example, becomes hx-confirm:inherited if child controls should receive it. The syntax is a small change, but missing it can alter requests, targets and headers throughout an application.
htmx ships an upgrade checker that scans templates and scripts for inheritance issues, renamed or removed attributes, old event names and obsolete APIs. The tool supports common template formats including HTML, PHP, Jinja, ERB and Handlebars.
Events now follow a consistent htmx:phase:action structure. htmx:beforeRequest becomes htmx:before:request, for example. Most errors collapse into htmx:error, XMLHttpRequest-specific events disappear, and htmx defers form validation events to native browser behavior.
History handling also changes. htmx 2 stored page snapshots in localStorage, where DOM mutations introduced by third-party JavaScript could survive restoration after the code responsible for them had not. htmx 4 refetches the page during back navigation by default. Developers who need local caching can use an extension backed by sessionStorage.
From an empty room to a 49,000-star project
Gross built htmx after intercooler.js, its earlier project and predecessor. In a DjangoCon US interview, he recalled giving a talk about the project to "an almost empty room." The htmx repository now has about 49,000 GitHub stars, though stars measure developer attention rather than production deployment.
His route to open source was similarly indirect. Gross said he left an undergraduate computer science program after becoming overwhelmed, found programming work anyway, later completed a master's degree, and spent roughly a decade at a Bay Area software company. He subsequently founded and sold a small company before moving to Montana and teaching at Montana State.
Gross's university profile lists courses in systems programming, databases, compilers, software engineering and hypermedia systems. That teaching work runs alongside htmx and related projects including fixi, hyperscript and idiomorph. His stated preference for simple principles and durable architecture appears throughout htmx 4: modern browser internals are paired with a deliberate effort to preserve applications built around older behavior.
The work also reflects the economics of open-source maintenance. htmx accepts support through GitHub Sponsors. When htmx joined the first GitHub Open Source Accelerator cohort in 2023, Gross wrote that he hoped the program might help make htmx development a full-time job.
Alexander Petros, a contributor to the release, lists maintenance of Dartmouth College's Outdoor Programs registration system using htmx on his public resume. That work gives Petros direct experience operating the architecture the project advocates.
htmx's homepage describes the dependency-free library as roughly 16 kilobytes when minified and compressed. It gives developers AJAX requests, partial-page updates, CSS transitions, WebSockets and server-sent events through HTML attributes, keeping application state and rendering logic primarily on the server.
htmx 4 pushes that model into streaming, morphing and lightweight browser reactivity, areas often handled by larger frontend systems. Gross has still chosen a slow default rollout. The code is ready for developers who want it; the npm tag will wait until the maintainers believe an automatic upgrade is the safer choice.