2026Architecture & APIsLanguages & standardsPreprint
Can developers build an interactive web interface in Kotlin?
In a sample web application, developers used Kotlin on the server to build interactive controls with very little JavaScript.
Where do the interaction rules live?#
A team can end up describing the same behavior twice, once on the server and again in the browser. The authors extended HtmlFlow, a Kotlin library for writing HTML, so developers can also express Datastar controls in Kotlin. The type checker can then check how a control connects to the value that drives it.
What did the prototype demonstrate?#
The team implemented a set of common interaction patterns and applied them in Petclinic, a Spring MVC example application. Changes in server-managed values could update the browser interface while keeping nearly all of the interaction code in Kotlin. The examples demonstrate feasibility. Long-term maintenance costs remain an open question.
Original paper
BRHC: Backend-driven Reactive Hypermedia Controls with a Statically Typed Kotlin DSL
Original abstract
AI-assisted coding tools (e.g., Copilot, Cursor, Claude) are increasingly ubiquitous and enable rapid generation of web applications. However, this raises concerns regarding complexity, longevity and the long-term maintainability of generated systems. A key source of complexity is the heterogeneity between backend and frontend programming models, where multiple languages and paradigms are combined within a single application, often leading to duplicated logic and fragmented state management. To address this issue, recent approaches (e.g., HTMX, Turbo Hotwire, Datastar, etc.) follow the Hypermedia-Driven Application (HDA) model, positioning HTML as the primary communication medium between client and server. Unlike SPA-centric architectures, HDA systems shift the application state and interaction logic to the server, where backend-driven reactive signals synchronize with the client user interface. However, these approaches still introduce complexity through custom attributes and do not fully eliminate JavaScript, particularly in computed expressions. In this work, we propose a statically typed approach using a Kotlin-based HTML DSL (Domain-Specific Language) for backend-driven reactive web applications. We extend the HtmlFlow Kotlin DSL with typed custom HTML attributes (i.e., Datastar data-* attributes) and signal-based bindings using statically typed builders. We demonstrate the approach through a catalog of reactive interaction patterns and a Petclinic Spring MVC case study. The results indicate that the proposed approach can nearly eliminate the need for JavaScript while improving type safety and preserving a homogeneous programming model across frontend and backend, bridged through a backend-driven reactive, signal-centric architecture.