What is Kweb?
Kweb is a library for building web applications in the Kotlin programming language, that virtually eliminates the separation between browser and server from the programmer’s perspective.
Kweb allows you to interact to the browser DOM directly as if it was local to the web server. This process is efficient, minimizing browser-server chatter and browser rendering overhead. DOM fragments are also cached in the browser for an extremely responsive UI, and events are conveyed seamlessly between client and server to maintain consistent state across both.
In this simple example we attach a click listener to a hyperlink which increments a global click counter. Note how the counter is truly global, and changes to it propagate automatically to browsers:
This is just a simple example, but the paradigm scales up nicely.
- Build websites in Kotlin
- Makes the barrier between web-browser and web-server largely invisible to the programmer
- Combines surprising convenience for the programmer with efficiency under the hood, minimizing client-server chatter and browser render times
- Bind DOM elements in the browser directly to state on the server and have them update automatically, through the observer and data mapper patterns
- Easy to add to an existing project, Kweb is just a library, it doesn’t seek to tell you how your project should be organized
- Update your web browser instantly in response to code changes
How does it work?
Kweb keeps all of the logic server-side, and uses efficient websockets to communicate to web browsers. We also take advantage of Kotlin’s powerful new coroutines mechanism to efficiently handle asynchronicity, largly invisibly to the programmer.
Can I see an example?
Next: Setting Up »»