DEV Community

Cover image for Kotlin for Server-Side
Victor Loveday
Victor Loveday

Posted on

Kotlin for Server-Side

With Kotlin, we can create different applications for different platforms. Server-side applications are no exception. Similarly to Java, Kotlin can be used to set up and run server side applications. Several frameworks like Spark and Spring which is used with Java also have support for Kotlin. I will show you four of them as we proceed. But first;


Ktor (pronounced Kay-tor) is an asynchronous open source framework for creating micro services and web applications. It was developed with Kotlin by Jetbrains. The framework is lightweight and has a great support for coroutines and KMM (Kotlin Multi Platform).

Four frameworks for server-side development with Kotlin

  1. Spring Boot: This framework is widely used for creating stand-alone Spring Based Applications. Applications created with Spring Boot are of large-scale, production-grade, while you just need to trigger the run button.

  2. Javalin: This framework is referred to as the most lightweight for Kotlin and Java server-side development. Javalin supports network configuration components such as Web Sockets, HTTP2 and async requests and so on. Javalin was initiated as a clone of Java. Although it was not anticipated by its developers, still Javalin emerged into a wider framework. It was moulded into a ground-up rewrite, with reference to the JavaScript framework koa.js.

  3. Spark: Spark is one of the earliest expressive Kotlin or Java web framework built for rapid development. It can also be used in higher-level Kotlin development. It is not so popular. Spark is not so trusted with respect to micro-services.

  4. Vert.X: Just like Java and Kotlin, Vert.X is an ecosystem used for building reactive applications in different programming languages. Vert.X comes with a powerful set of tools. However, it is not advisable for everyone. It comes with detailed documentation and is thoroughly compatible with Kotlin libraries. It creates reactive Web applications for the Java Virtual Machine.

Why Ktor ?

It is a very lightweight framework that reduces the effort required to create web applications in Kotlin. It doesn’t manipulate the underlying technologies of a project and is compatible with most of them, with very rare exceptions.

It is highly reliable, as it is a product of the Kotlin team, itself. It allows developers to rapidly create both, client and server-side applications that target multiple platforms. Ktor exploits Kotlin Coroutines for providing high scalability and offers an efficient and idiomatic API for developers.

It works on a minimum memory footprint and comes in as a lightweight thread. It is analogous to Javalin, it is also a real micro-framework plus it's simplicity. Left to me, I'd say it's the most suitable for prototyping.

Top comments (0)