Session

A Fully Functional State: Multiplayer Apps with http4k Fanbelt

Open your favourite chat app in a browser and watch the network tab: hundreds of requests and megabytes downloaded before you've even typed a word. Behind that sits a client-side store, a cache, a socket protocol and a JS build chain to hold it all together. Over on the server it's all being done again, with an API and an event stream keeping that second copy of the state in sync.

But what if it could be simpler? Lightweight libraries such as Datastar and htmx mean the browser no longer needs reams of JavaScript, or a JS toolchain at all. No npm, no bundler, no client build: one tiny script, and HTML straight from the server. What they don't give you is the hard part: where the state lives, what a change is, and how every screen finds out about changes.

The JVM had no good answer to that, so we built one: http4k Fanbelt. Named after the belt that keeps an engine running, it’s a single loop carrying data in one direction. A user acts, the server changes the state, and every screen watching on every node re-renders. And because it's http4k, you get a fully functional approach and testing at every level, all in plain Kotlin.

In this talk we'll walk through Fanbelt's concepts and build a live multi-node chat in under 100 lines of Kotlin. We'll also see how far we can push the model: a Slack-style chat with channels, attachments, canvases, URL previews, typing indicators, reactions and mentions, built from the same primitives without a line of JavaScript of our own.

Join us to see how much one small loop can drive.

David Denton

Engineering Lead // Founder // Trainer // Speaker // Kotlin GDE // Co-creator of http4k

London, United Kingdom

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top