2 min read

Kweb is a library using which you can easily build web applications in the Kotlin programming language. It basically eliminates the separation between browser and server from the programmer’s perspective. This means that events that only manipulate the DOM don’t need to do a server-roundtrip. As Kweb is written in Kotlin, users should have some familiarity with the Kotlin and Java ecosystem.

Kweb allows you to keep all of the business logic in the server-side and enables the communication with the web browser through efficient websockets. To efficiently handle asynchronicity, it takes advantage of Kotlin’s powerful new coroutines mechanism. It also allows keeping consistent state across client and server by seamlessly conveying events between both.

What are the features of Kweb?

  • Makes the barrier between the web server and web browser mostly invisible to the programmer.
  • Minimizes the server-browser chatter and browser rendering overhead.
  • Supports integration with some powerful JavaScript libraries like Semantic, which is a UI framework designed for theming.
  • Allows binding DOM elements in the browser directly to state on the server and automatically update them through the observer and data mapper patterns.
  • Seamlessly integrates with Shoebox, a Kotlin library for persistent data storage that supports views and the observer pattern.
  • Easily add to an existing project.
  • Instantly update your web browser in response to code changes.
  • The Kweb library is distributed via JitPack, a novel package repository for JVM and Android projects.

Kweb takes advantage of the fact that in most web apps, logic occurs in the server side and the client can’t be trusted. This library is in its infancy but still works well enough to demonstrate that the approach is practical.

You can read more about Kweb on its official website.

Read Next

Kotlin based framework, Ktor 1.0, released with features like sessions, metrics, call logging and more

Kotlin 1.3 released with stable coroutines, multiplatform projects and more

KotlinConf 2018: Kotlin 1.3 RC out and Kotlin/Native hits beta


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.