Yorgos S.
08/26/2026, 7:33 AM0.4.0 is out with the two biggest additions so far.
Compile-time OpenAPI generation
A Kotlin compiler plugin (ktkit-compiler-openapi) that generates the OpenAPI 3.1 spec of your REST handlers at compile time — no reflection, so it works on every KMP target, JVM and Native alike. Route metadata comes from annotations placed right where the route is declared:
@OpenApi("Returns a single user by id.")
GET("/{id}") {
@OpenApiInfo("The id of the user.")
val id = pathVariable("id").asUuid()
// ...
}
@OpenApiInfo also documents @Serializable classes and their properties, and @OpenApiIgnore excludes a route or a whole handler. At runtime the framework merges the generated fragments and serves interactive docs at /api/docs (Swagger UI or Scalar API Reference) plus the merged document at /api/docs/openapi.json. See a full example here.
A Gradle plugin to configure the whole thing
io.github.smyrgeorge.ktkit is now the single entry point of a ktkit build. It applies the OpenAPI compiler plugin, kotlinx.serialization and log4k, and manages the matching library versions for you:
plugins {
kotlin("multiplatform")
id("io.github.smyrgeorge.ktkit") version "0.4.0"
}
ktkit {
sqlx4k {
driver = PostgreSQL
generatedCodePackage = "com.example.generated"
extensions(Pgmq)
}
jar { mainClass = "com.example.MainKt" }
}
The sqlx4k { } block wires up KSP, the sqlx4k code generator and the driver dependencies; jar { } turns jvmJar into a runnable fat jar. Everything is opt-out (addDependencies = false, openApi { enabled = false }, …). See a full example here.
Repo: https://github.com/smyrgeorge/ktkit
Docs: https://smyrgeorge.github.io/ktkit/
Changelog: https://github.com/smyrgeorge/ktkit/compare/0.3.0...0.4.0