Introduction
Brew is Kona’s reactive server-component product. You write a class with public state and actions, render HTML with Crema, and Brew keeps the browser in sync over a small JSON protocol—without a full page reload for every interaction.
(Brief nod: Brew occupies the same problem space as popular full-stack reactive component tools. The rest of this site describes Brew on its own terms.)
When to use Brew
Section titled “When to use Brew”Use Brew when you want:
- Server-owned state — form drafts, filters, pagination, and UI toggles live on the JVM.
- Incremental HTML updates — the client morphs returned HTML into the existing DOM.
- Kotlin and Java equally — the same component model, with first-class Java samples and tests.
- Tight Crema integration — templates, layouts, and directives stay in one stack with Kona.
Prefer a JSON API + SPA when the UI is almost entirely client-driven and the server is only a data plane. Prefer plain Kona controllers + Crema when interactions are rare and full page responses are enough.
What you get
Section titled “What you get”- A component class — public fields are state; public methods are actions the browser can call.
- A snapshot on the root HTML element (
wire:snapshot,wire:effects,wire:id,wire:name). - A client runtime that posts to
POST /brew/updateand morphs the new HTML into place. - A bundled Alpine.js runtime — Brew ships Alpine 3.x plus plugins; you do not install Alpine separately for the default script tag.
How a click works
Section titled “How a click works”- The browser finds the component root (
wire:id) and readswire:snapshot. - It
POSTs{ _token, components: [{ snapshot, updates, calls }] }to/brew/updatewith theX-Brewheader. - The server verifies CSRF + checksum, restores state, runs the action, re-renders, and returns
{ components: [{ snapshot, effects }], assets }. - The client morphs
effects.htmlinto the DOM (keyed bywire:key/wire:id).
Corrupt checksums or locked-property writes fail the request. Missing components or unknown actions raise Brew exceptions.
Relationship to Kona
Section titled “Relationship to Kona”Brew is a separate artifact (org.konaframework:kona-brew) and a separate repository (konaframework/kona-brew). It depends on Kona HTTP, session, Crema, and related modules. Framework guides for routing, Crema, and grind live on the Kona docs site.
- Requirements — JDK, Kona, Node
- Installation — Gradle, provider, assets
- Your first component — Kotlin + Java walkthrough