Effortless REST API Development with Kotlin

A configuration-free, embeddable web server for Kotlin and the JVM - the port of GenHTTP, built on coroutines and virtual threads.

implementation("org.genhttp:genhttp-full:11.1.0.3")

Open source under the MIT license, on Maven Central for JDK 25 and later.

Service

Kotlin
import org.genhttp.engine.internal.Host
import org.genhttp.modules.functional.*
import org.genhttp.modules.practices.*

// http://localhost:8080/users/42

suspend fun main() {
    val api = Inline.create()
        .get("/users/:id") { id: Int -> User(id, "Jane") }

    Host.create()
        .handler(api)
        .defaults()
        .run()
}

data class User(val id: Int, val name: String)

Open API

Kotlin
import org.genhttp.engine.internal.Host
import org.genhttp.modules.functional.*
import org.genhttp.modules.openapi.*
import org.genhttp.modules.practices.*

// http://localhost:8080/openapi.json

suspend fun main() {
    val api = Inline.create()
        .get("/users/:id") { id: Int -> User(id, "Jane") }
        .addOpenApi()

    Host.create()
        .handler(api)
        .defaults()
        .run()
}

data class User(val id: Int, val name: String)

JWT

Kotlin
import org.genhttp.engine.internal.Host
import org.genhttp.modules.authentication.*
import org.genhttp.modules.functional.*
import org.genhttp.modules.openapi.*
import org.genhttp.modules.practices.*

suspend fun main() {
    val auth = BearerAuthentication.create()
        .issuer("https://sso.example.com/")

    val api = Inline.create()
        .get("/users/:id") { id: Int -> User(id, "Jane") }
        .addOpenApi()
        .add(auth)

    Host.create()
        .handler(api)
        .defaults()
        .run()
}

data class User(val id: Int, val name: String)
What is included

A web server you add like any other library

No configuration files, no hosting model to learn. genhttp-kt is a library you depend on, configure in code and run wherever your application runs.

One of the fastest Kotlin web servers for HTTP/1.1

According to HTTP Arena, genhttp-kt is among the fastest Kotlin web servers for HTTP/1.1: with the Netty engine it ranks second of all the Java and Kotlin frameworks without tuning, and the internal engine is still 1.4 times faster than Ktor and 2.6 times faster than Spring Boot.

Performance, the engines and how they are verified

Composite HTTP/1.1 score of Java and Kotlin frameworks without tuning, measured by HTTP Arena on October 24, 2026
  1. ktron Kotlin 7,711
  2. genhttp-kt-netty Kotlin 5,648
  3. vertx Java 4,874
  4. micronaut Java 3,989
  5. genhttp-kt Kotlin 3,869
  6. helidon Java 3,516
  7. ktor Kotlin 2,796
  8. neton Kotlin 2,100
  9. jooby Java 1,993
  10. http4k Kotlin 1,633
  11. spring-boot Java 1,509

One application, two engines

Replace the HTTP engine without touching your application code - change the dependency and the package of the Host you import.

GenHTTP, kept in sync by agents

genhttp-kt is the Kotlin port of GenHTTP, made and maintained by Claude. GenHTTP stays the source of truth, genhttp-kt follows it commit by commit - and the build checks every step mechanically.

Version
11.1.0.3
Based on
GenHTTP 11.1.0

How the port is made

  1. GenHTTPupstream

    A change lands in the C# repository. A daily check lists what has not been ported yet.

  2. Portagent

    An agent ports it - code and tests together, one commit per upstream change, written the Kotlin way.

  3. Verifybuild

    Nothing is released unless it holds up.

    • 1,000+ tests mirrored 1:1
    • Public API compared to upstream
    • ABI dumps reviewed
    • 90 % line coverage
    • Linux, Windows, macOS on x64 and arm64
  4. ReleaseMaven Central

    Versions follow GenHTTP: 11.1.0.3 is based on GenHTTP 11.1.0, the last digit counts releases of the port.

The same API, the Kotlin way

Code written for GenHTTP reads the same in genhttp-kt - builders, modules and concepts carry over one to one, expressed with suspend functions, lambdas and data classes.

GenHTTP

C#
var books = new List<Book> { new(1, "Lord of the Rings") };

var api = Inline.Create()
    .Get(() => books)
    .Get(":id", (int id) => books.FirstOrDefault(b => b.Id == id))
    .Post((Book book) => { books.Add(book); return book; });

await Host.Create()
    .Handler(api)
    .Defaults()
    .RunAsync();

public record Book(int Id, string Title);

genhttp-kt

Kotlin
val books = mutableListOf(Book(1, "Lord of the Rings"))

val api = Inline.create()
    .get { books }
    .get(":id") { id: Int -> books.firstOrNull { it.id == id } }
    .post { book: Book -> book.also { books.add(it) } }

Host.create()
    .handler(api)
    .defaults()
    .run()

data class Book(val id: Int, val title: String)

Coming from GenHTTP

Pick the framework that fits your application

Every framework runs on the same server and the same modules, so you can mix them within one application.

All about frameworks

Talk to us

Questions, ideas or a project of your own - the community and the team behind GenHTTP are glad to help.