Modern websites consist of at least two tightly coupled components, one runs in the browser, the other on the server. These are often written in different programming languages and must communicate with each other over an HTTP connection.

Kweb’s goal is to eliminate this server/browser separation so that your webapp’s architecture is determined by the problem you’re solving, rather than the limitations of today’s tools.

How does it work?

Kweb is a self-contained Kotlin library that can be added easily to new or existing projects. When Kweb receives a HTTP request it responds with the initial HTML page, and some JavaScript that connects back to the web server via a WebSocket. The page then waits and listens for instructions from the server, while notifying the server of relevant browser events.

A common concern about this approach is that the user interface might feel sluggish if it is server driven. Kweb solves this problem by preloading instructions to the browser to be executed immediately on browser events without a server round-trip.

Kweb is built on the excellent Ktor framework, which handles HTTP, HTTPS, and WebSocket transport. You don’t need to know Ktor to use Kweb, but if you’ve already got a Ktor app you can embed Kweb as a Feature.


  • Allows the problem to determine your architecture, not the server/browser divide
  • End-to-end Kotlin (Why Kotlin?)
  • Keep the web page in sync with your back-end data in realtime, Kweb does all the plumbing for you
  • Server-side HTML rendering with rehydration
  • Efficient instruction preloading to avoid unnecessary server communication
  • Very lightweight, Kweb is less than 5,000 lines of code

Professional Services

If you’re interested in professional services related to Kweb from the people who built Kweb please email