01
Ktor owns the request
Routes stay small, typed, and testable while the server decides which HTML fragment to return.
Server-rendered interactivity
This sample uses Ktor for routing and HTML generation, then lets htmx progressively enhance navigation by swapping server-rendered fragments into the existing page shell.
01
Routes stay small, typed, and testable while the server decides which HTML fragment to return.
02
Navigation, history, and targeted swaps happen through attributes instead of a client-side router.
03
kotlinx.html keeps page structure close to application code with compiler-checked HTML builders.
The browser gets useful HTML at every step. htmx improves the experience without hiding the server contract.
hx-target="#content"The link still has a normal href, so the page remains useful without custom JavaScript.
hx-get calls endpoints like /components/projects and targets only the #content region.
The response is plain HTML, which makes rendering fast, debuggable, and easy to test.