fun main() {
embeddedServer(Netty, port = 8000) {
routing {
get ("/") {
call.respondText("Hello, world!")
}
}
}.start(wait = true)
}

Simple and fun

Create asynchronous client and server applications. Anything from microservices to multiplatform HTTP client apps in a simple way. Open Source, free, and fun!

Build Backend

The Ktor HTTP server offers features like powerful routing, a robust plugin system, and simple configuration. By leveraging kotlinx.coroutines and JetBrains’ tooling support, Ktor can enhance your backend development.

Start
Latest release: 3.0.2
StartLearn
Latest release: 3.0.2
suspend fun main() {
val client = HttpClient {
install(WebSockets)
}

client.ws("ws://example.com/ws") {
send(Frame.Text("Hello, world!"))

val frame = incoming.receive()
println("Received: $frame")
}
}

Create Client

The Ktor HTTP client simplifies sending requests, handling responses, and managing real-time communication with WebSockets and server-sent events (SSE).

JVMAndroidNativeiOSWasm

Why Ktor?

Kotlin and Coroutines

Ktor is built from the ground up using Kotlin and Coroutines. You get to use a concise, multiplatform language, as well as the power of asynchronous programming with an intuitive imperative flow.

Lightweight and Flexible

Ktor allows you to use only what you need, and to structure your application the way you need it. In addition you can also extend Ktor with your own plugin very easily.

Built and backed by JetBrains

Brought to you by JetBrains, creators of IntelliJ IDEA, Kotlin, and more. Ktor is not only used by our customers, but also internally at JetBrains. In addition, you have top-notch tooling support!


Rares Vlasceanu, Adobe

«Ktor is straightforward, yet very powerful and extensible! Its simplicity helps us prototype fast. Being coroutine-native (fully async) helps us build large scale server-side applications handling billions of events / day»

Rares Vlasceanu, Adobe

Burak Akgün, HTG

«I believe the future is bright for Ktor! It is so robust and fast to work with, and it is written in Kotlin! It has a variety of options that make it easy to develop and deploy via Gradle and Maven, which is great.»

Burak Akgün, HTG