About Server-Driven Web Apps with htmx

The htmx JavaScript library gives you a new way to craft web applications. The htmx approach differs significantly from the currently popular single-page application (SPA) frameworks; rather than write a bunch of JavaScript, you simply annotate HTML elements before sending them to the browser. The resulting code is easier to understand and modify, and because it downloads less to the browser and doesn’t need JSON creation and parsing, you’ll find it performs better, too.

  • Rethink web application design; write code in any language that simply responds to requests with htmx snippets.
  • Dynamically update portions of the current web page directly from the server.
  • Implement common patterns such as lazy loading, input validation, CSS transitions, active search, optimistic updates, pagination, infinite scroll, polling, and click-to-edit.
  • Add interactivity with JavaScript and libraries such as Alpine and _hyperscript.
  • Use the htmx JavaScript API to simplify DOM operations.
  • Make your web apps more secure: escape user-supplied content, use Subresource Integrity hashes, and enforce a Content Security Policy.
  • Go beyond the basic HTTP request/response pattern with WebSockets and server-sent events.

Discover a simpler way to implement web applications that emphasizes web fundamentals.

For the paperback edition, please support your local independent bookstore.

--

--