htmx 4.0.0 Modernizes Core with Fetch API and HTML Streaming
The major update replaces XMLHttpRequest and introduces LLM-specific guidance to optimize AI-assisted development.
The htmx team has released version 4.0.0, marking the end of an eight-month development cycle that fundamentally modernizes the library's networking core. The update signals a decisive shift toward current web standards and AI-driven workflows.
At the center of the release is the replacement of the aging XMLHttpRequest with the modern fetch() API for all network requests. Beyond the API swap, htmx 4.0.0 introduces native support for streaming HTML, allowing servers to push content to the browser more efficiently. To improve the developer ecosystem, the team added the 'hx-alpine-compat' feature to resolve long-standing compatibility friction between htmx and Alpine.js. Additionally, the release includes dedicated 'skills' files—such as htmx-guidance and htmx-debugging—specifically designed to improve the accuracy of LLM-assisted development.
The Path to Version 4
htmx has long championed a server-side rendered (SSR) architecture, providing developers with the ability to access AJAX, CSS Transitions, WebSockets, and Server Sent Events directly within HTML. This approach serves as a lightweight alternative to heavy client-side JavaScript frameworks like React. For years, the library maintained strict backwards compatibility via XMLHttpRequest, but the transition to fetch() reflects the industry's broader move toward modern JavaScript standards.
In a nod to the community's internal culture, the team skipped version 3.0 entirely. According to project details, the version number 4.0.0 was chosen as a joke to maintain the "spirit" of a previous promise that a version 3 would never exist, while still providing a clear signal that the update contains breaking changes.
Implications for AI and Performance
The move to fetch() and the addition of HTML streaming are expected to improve both performance and the overall developer experience. However, the most strategic addition is the focus on LLM 'skills' files. By providing structured guidance for AI, htmx is positioning itself as a primary target for "vibe coding" and AI-generated interfaces. Because htmx is declarative, it is naturally well-suited for AI code generation, and these new files aim to reduce the hallucinations often associated with LLMs writing frontend code.
What to Watch
As developers migrate to 4.0.0, the primary focus will be on the breaking changes necessitated by the removal of XMLHttpRequest. The industry will be watching to see if the inclusion of LLM-specific guidance becomes a new standard for library maintainers seeking to optimize their tools for AI agents. While the core features are now live, the long-term impact of HTML streaming on SSR performance benchmarks remains the next key metric for the community to evaluate.