Modern frontends with htmx

Use htmx with SpringBoot and Thymeleaf to build dynamic and interactive web applications

About the book

Imagine creating dynamic, interactive web applications with minimal JavaScript. That’s the revolutionary promise of htmx, a technology that redefines frontend development. This book is your gateway to mastering htmx alongside Java, Spring Boot, and Thymeleaf, transforming the way you build web interfaces.

This book starts with the basic steps of using htmx, starting from the basic techniques of DOM element swapping through various triggers. It progressively delves into more complex topics, such as responding to htmx requests in the Spring Boot controller and implementing comprehensive UI patterns like lazy loading, active search, and endless scrolling. Further, the book dives into the integration of web components and JavaScript frameworks with htmx to amplify client-side interactivity.

Throughout the book, two projects put all these ideas together. These projects help you see how everything you've learned works in real web applications.

The book has chapters about the following topics
  • Htmx syntax: triggers and targets
  • Swapping
  • Request and response headers
  • The htmx-spring-boot library
  • Out of band swaps
  • Client-side scripting with JavaScript and Alpine
  • Security with htmx
  • Click to load and endless scroll
  • Active search
  • Realtime form validation
  • Combining web components and htmx
  • Using Server-sent events and websockets

The full table of contents of the book can be seen on the Leanpub page.

Super-charge your learning now with Modern frontends with htmx!

You can also get the book with a discount when buying the Modern Thymeleaf Bundle which includes this book and Taming Thymeleaf.

What people are saying

Carson Gross
Senior Software Engineer
Creator of htmx

I could not be more excited about Wim's book, Modern frontends with htmx. It gives Java developers the tools to work effectively with htmx as a front end library, with an in-depth treatment of all of the major features of htmx and, more importantly, practical examples of how they can be used in conjunction with Spring and Thymeleaf.

Htmx can be a very effective way to build modern web applications, but it is useless without similarly effective server-side tools. In this book Wim shows you not only how to use htmx, but how to use htmx effectively with Spring and Thymeleaf. This "completes the circle" of modern web development with htmx and Java, and unlocks the promise of dynamic and modern web applications that don't break the complexity bank for Java developers. Thank you Wim!

Thomas Maxwell
Freelance Software Developer

After Taming Thymeleaf and Practical Guide to building an API backend with Spring Boot Wim has produced another invaluable resource when it comes to learning htmx. The book touches upon all the important parts and showcases the capabilities of htmx.

Whether you've never used htmx or have already used it extensively, you are sure to find some gems that you didn't yet know about. Htmx is, in my opinion, a library that should be seriously considered when building web applications, especially when you combine it with AlpineJS or hyperscript. This book further strengthens that belief.

Application screenshots

These are some screenshots from the various example applications you will build. Click on the screenshot to view an animation of the application in action.
TodoMVC clone
Timesheet application that demonstrates Out of Band swaps
Inline editing and drag and drop
Bookmarks application to demonstrate security
Contacts application from Hypermedia Systems ported to Spring Boot
Integration of Shoelace Web Components
Using Server-sent events with htmx
Chat application using websockets