# Modern frontends with htmx

Author: [Wim Deblauwe](https://www.wimdeblauwe.com/about/) | Canonical: https://www.wimdeblauwe.com/books/modern-frontends-with-htmx/

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

## About the book

[![Modern frontends with htmx book cover](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/cover-small.jpg)](https://leanpub.com/modern-frontends-with-htmx)

Imagine creating dynamic, interactive web applications with minimal JavaScript. That’s the revolutionary promise of [htmx](https://htmx.org/), a technology that redefines frontend development. This book is your gateway to mastering htmx alongside Java, [Spring Boot](https://spring.io/projects/spring-boot), and [Thymeleaf](https://www.thymeleaf.org/), 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](https://leanpub.com/modern-frontends-with-htmx) of the book can be seen on the Leanpub page.

Super-charge your learning now with [Modern frontends with htmx](https://leanpub.com/modern-frontends-with-htmx)!

[Buy the e-book - $34.99](https://leanpub.com/modern-frontends-with-htmx) [Buy the paper book - $49.95 / €45.95](https://www.lulu.com/shop/wim-deblauwe/modern-frontends-with-htmx/paperback/product-rme4eq9.html)

Contact me via [wim.deblauwe@gmail.com](mailto:wim.deblauwe@gmail.com) if you bought the paper book and want to get the e-book for free.

You can also get the book with a discount when buying the [Modern Thymeleaf Bundle](https://leanpub.com/b/modern-thymeleaf-bundle) which includes this book and [Taming Thymeleaf](https://www.wimdeblauwe.com/books/taming-thymeleaf).

## What people are saying

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/carson-gross.jpeg)

[Carson Gross](https://twitter.com/htmx_org)

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!

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/sergej-lopatkin.jpeg)

[Sergej Lopatkin](https://twitter.com/serrsch)

Software Engineer in  
Logistics/Green Energy IoT

_Modern frontends with htmx_ is an essential guide for developers eager to integrate htmx into their Java-centric projects. This book skillfully bridges htmx with staples —Spring Boot, Thymeleaf, and TailwindCSS— presenting a formidable stack for modern web development.

His methodical approach not only clarifies htmx's utility but also elegantly sidesteps the all-too-common pattern of creating overly complex JavaScript SPA frontends, each redundantly paired with a mini backend. This book is packed with relevant real-world examples for leveraging htmx effectively.

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/thomas-maxwell.jpeg)

[Thomas Maxwell](https://www.bluemagma.be/)

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.

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/todomvc-2.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/todomvc.gif)

_[TodoMVC](https://todomvc.com/) clone_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/timesheets.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/timesheets.gif)

_Timesheet application that demonstrates Out of Band swaps_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/inline-editing-final.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/inline-editing.gif)

_Inline editing and drag and drop_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/bookmarks-3.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/bookmarks.gif)

_Bookmarks application to demonstrate security_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/contacts-13.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/contacts.gif)

_Contacts application from [Hypermedia Systems](https://hypermedia.systems/) ported to Spring Boot_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/githubtree-02.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/githubtree.gif)

_Integration of [Shoelace](https://shoelace.style/) Web Components_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/ssedemo-04.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/ssedemo.gif)

_Using Server-sent events with htmx_

![](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/wsdemo-02.png) [View in action](https://www.wimdeblauwe.com/images/modern-frontends-with-htmx/wsdemo.gif)

_Chat application using websockets_

