Logo
flag

Server-Driven Web Apps with htmx

Logo

Please rate the book

0.0
Language:
English
pages:
182 pages
Release date:
14/08/2024
Rating:
0.0

Book short description

htmx is a library that adds logic and server interaction to HTML, providing the effect of using a frontend SPA framework without the need to write frontend code. You can use any server-side programming language and framework to create server-side applications with endpoints that simply return HTML fragments. Dynamically update parts of the current web page based on HTTP responses. Add interactivity using JavaScript and libraries like Alpine and _hyperscript. Make your applications more secure by sanitizing user input and setting a Content Security Policy. Extend capabilities beyond ordinary HTTP requests using WebSockets and server-sent events.


The JavaScript library htmx offers a new way of creating web applications. The htmx approach is significantly different from the currently popular SPA frameworks (Single-Page Application); instead of writing a large amount of JavaScript code, you simply annotate HTML elements before sending them to the browser. Such code is easier to understand and modify, and because less data is loaded into the browser and there is no need to create and parse JSON, performance is also improved.

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


SkillHunt logo
This material is included in the paid subscription. Subscribe to a premium subscription and watch all courses right now!