Overview
Ktor is a framework for creating asynchronous client and server applications in Kotlin, from microservices to multiplatform HTTP clients. It is written in Kotlin from the ground up and uses coroutines, so asynchronous code reads like ordinary imperative code and host implementations avoid blocking threads.
It is unopinionated: Ktor does not impose choices for logging, templating, persistence, serialization or dependency injection. Features are installed as plugins through a unified interception pipeline, and routes are declared with a Kotlin DSL. Applications run standalone on Netty or Jetty or in a servlet container such as Tomcat.
Ktor apps can run in a test environment that emulates a server without real networking, which makes integration tests fast. A Gradle plugin and a project generator at start.ktor.io help set up projects.
Ktor is an official JetBrains product, used internally at JetBrains, with IDE support in IntelliJ IDEA. The repository dates from 2015 and the project is Apache-2.0 licensed.
Pricing and plans
What it does
- Coroutines
- Asynchronous I/O with Kotlin coroutines throughout.
- Routing DSL
- Declarative routes written in Kotlin.
- Plugins
- Install features through an interception pipeline; write your own easily.
- Multiple engines
- Netty, Jetty or Servlet 3.0+ containers.
- Test host
- Test applications without real networking.
- Multiplatform client
- The same project provides a Kotlin Multiplatform HTTP client.
Strengths and limitations
Strengths
- Backed and used by JetBrains, with strong IDE tooling
- Lightweight compared with Spring Boot
- Idiomatic Kotlin with coroutines
- Fast in-memory testing
Limitations
- Kotlin only; Java-first teams get little benefit
- Unopinionated: persistence, DI and project structure are your choice and your work
- Smaller ecosystem than Spring Boot for enterprise integrations
- No built-in ORM or DI container; you pick and wire those libraries yourself
Who it suits
Good for
- Kotlin microservices and APIs
- Teams that share Kotlin code between server and clients
- Developers wanting a lighter JVM framework
Look elsewhere if
- Java-only teams
- Enterprises needing Spring's breadth of integrations
Alternatives to Ktor
| Tool | From | Free option | Stages |
|---|---|---|---|
| Phoenix Elixir web framework | — | ||
| Encore Backend framework with infrastructure from code | $49/mo | Free tier | |
| AdonisJS Batteries-included TypeScript MVC framework | — | ||
| FastAPI Python API framework | $20/mo | Free tier | |
| Hono Web-standards TypeScript web framework | — | ||
| ASP.NET Core .NET web framework | — |
Questions
Who makes Ktor?
JetBrains, the company behind Kotlin and IntelliJ IDEA.
Ktor or Spring Boot?
Ktor is lighter and Kotlin-native; Spring Boot offers a much larger ecosystem and more built-in integrations.
Is Ktor free?
Yes, it is Apache-2.0 licensed.
Can Ktor run on Tomcat?
Yes, in any Servlet 3.0+ container, or standalone on Netty or Jetty.
Sources read for this page