Kotlin toolkit for HTTP, REST, and microservice apps with coroutine-based async I/O. Ships as a library you embed and run on Netty, Jetty, or servlet containers.
Overview
Ktor is an asynchronous framework written in Kotlin for building connected applications such as microservices, HTTP APIs, and web backends. Developers add it as a dependency, define an application, install features through a unified pipeline, and run an embedded server or deploy to servlet hosts.
The design stays unopinionated about logging, templating, persistence, serialization, and dependency injection: you wire integrations via functions, transformers, or interceptors rather than fixed stacks. APIs lean on Kotlin DSL-style function calls, and composition can use functions, classes, or external DI as you prefer.
I/O is built around coroutines so hosts can use asynchronous facilities without blocking threads. Applications can run standalone on Netty or Jetty, or inside servlet containers with Servlet 3.0+ APIs such as Tomcat. A test environment emulates a server for integration tests without full networking.
A Gradle plugin can help configure BOM alignment, run tasks, and deployment workflows. Ktor also supports building client applications alongside servers. It is developed by JetBrains with community contributions.
Key features
- Kotlin coroutine-based async pipeline
- Pluggable features and interceptors
- Embedded Netty or Jetty servers
- Servlet container hosting
- HTTP routing and REST building blocks
- Test harness without real networking
- Kotlin DSL-style configuration
- Gradle plugin for builds and runs
Use cases
- Kotlin HTTP and REST APIs
- Microservice backends
- Multiplatform HTTP client apps
- Embedded web servers on localhost
- Integration tests for web handlers