talira

Build asynchronous servers and clients in Kotlin

open sourceApache-2.0self-hostablefree

Ktor is JetBrains' asynchronous framework for building servers and clients in Kotlin, from microservices and web applications to multiplatform HTTP client apps. It's built on Kotlin coroutines, so asynchronous code reads as plain imperative code, and its APIs are Kotlin DSLs: routing, plugins installed through a unified interception pipeline, and your own choice of logging, templating, serialization, persistence and dependency injection. Servers run standalone on Netty, Jetty or Ktor's own CIO engine, or in a Servlet 3.0+ container such as Tomcat, and a test environment emulates the server without networking. The Ktor client is multiplatform and works on Android, iOS and other Kotlin targets. Apache-2.0 licensed.

Problems it solves

  • build a REST API or microservice in Kotlin with coroutines
  • a lightweight Kotlin web framework without the weight of Spring
  • an HTTP client for Kotlin Multiplatform that works on Android and iOS
  • add websockets or server-sent events to a Kotlin server
  • test a Kotlin web app's routes without starting a real server
  • deploy a Kotlin server on Netty or in an existing Tomcat container

Features

  • built on Kotlin coroutines
  • routing and Kotlin DSL APIs
  • plugins through a unified interception pipeline
  • server engines: Netty, Jetty, CIO, and Servlet containers such as Tomcat
  • multiplatform HTTP client
  • test host that runs the app without networking
  • unopinionated about logging, templating, serialization, persistence and DI
  • project generator and IntelliJ IDEA tooling

Capabilities

Takes pluginsplan not known

Alternatives

The same job

These do what Ktor does.

  1. Retrofit A type-safe HTTP client for Android and Java
  2. OkHttp A meticulous HTTP client for the JVM, Android, and GraalVM
  3. Spring Boot Create stand-alone, production-grade Spring based applications that you can "just run"

Compare Ktor with the top 3