Write HTML with Compile-Time Safety
HtmlFlow is a Java DSL for building typesafe HTML templates in a fluent style. Get full IDE support, type checking, and excellent performance.

Type-Safe HTML Generation in Java and Kotlin
Write HTML in a typesafe, fluent style. Your IDE will guide you through valid HTML 5.2 structure.
1HtmlFlow
2 .doc(System.out)
3 .html() // HtmlPage
4 .head()
5 .title().text("HtmlFlow").__()
6 .__() // head
7 .body()
8 .div().attrClass("container")
9 .h1().text("My first page with HtmlFlow").__()
10 .img().attrSrc("http://bit.ly/2MoHwrU").__()
11 .p().text("Typesafe is awesome! :-)").__()
12 .__() // div
13 .__() // body
14 .__(); // html1HtmlFlow
2 .doc(System.out)
3 .html() // HtmlPage
4 .head()
5 .title().text("HtmlFlow").__()
6 .__() // head
7 .body()
8 .div().attrClass("container")
9 .h1().text("My first page with HtmlFlow").__()
10 .img().attrSrc("http://bit.ly/2MoHwrU").__()
11 .p().text("Typesafe is awesome! :-)").__()
12 .__() // div
13 .__() // body
14 .__(); // html1<html>
2 <head>
3 <title>HtmlFlow</title>
4 </head>
5 <body>
6 <div class="container">
7 <h1>My first page with HtmlFlow</h1>
8 <img src="http://bit.ly/2MoHwrU">
9 <p>Typesafe is awesome! :-)</p>
10 </div>
11 </body>
12</html>1<html>
2 <head>
3 <title>HtmlFlow</title>
4 </head>
5 <body>
6 <div class="container">
7 <h1>My first page with HtmlFlow</h1>
8 <img src="http://bit.ly/2MoHwrU">
9 <p>Typesafe is awesome! :-)</p>
10 </div>
11 </body>
12</html>Use Flowifier.fromHtml(String html) to convert existing HTML to HtmlFlow DSL
Why Choose HtmlFlow?
Typesafe & Compliant
Write valid HTML 5.2 with compile-time safety. Catch errors before runtime with full IDE support and type checking.
High Performance
Optimized for speed with excellent throughput and low overhead. Check the benchmarks to see performance results.
Pure Java/Kotlin
Templates are plain Java functions. No new templating language to learn. Use the full Java toolchain for templating.
Asynchronous Support
Bind to async data models seamlessly. Works with Reactive Streams, CompletableFuture, Kotlin coroutines, and any asynchronous API for progressive rendering.