Kest

Search

Search the documentation

Introduction

JVM languages

Which languages you can write a Kest application in, and how each one is wired.

Kest wires a Kotlin or Java application at build time: a KSP processor reads your annotated classes while the compiler runs and generates the connecting code. KSP only understands Kotlin and Java, so for Scala, Groovy and Clojure Kest has a second path that does the same job at start-up by reading the annotations through reflection (the reflect package) or, for Clojure, a small data-and-functions API.

LanguageStatusHow it is wiredBuild tool
Kotlinsupported, the primary languagebuild time (KSP)Gradle
Javasupported and tested (examples/java-api, with a real PostgreSQL)build time (KSP, hosted by the Kotlin Gradle plugin)Gradle
Scalasupported, tested over real HTTP (examples/scala-api)start-up, by reflectGradle (scala plugin)
Groovysupported, tested over real HTTP (examples/groovy-api)start-up, by reflectGradle (groovy plugin)
Clojuresupported, tested over real HTTP (packages/clojure)start-up, from kest.core dataGradle
Maven buildnot supported yet (planned, next)

How to set each one up, with working code: Scala, Groovy and Clojure.

What the start-up path gives up

The build-time path checks your wiring while compiling: a missing provider or a circular dependency is a build error. The start-up path finds the same problems, but when the application starts (still before it serves a request, and with the same messages). It also has a little more work to do at start-up, which for a typical application is a few milliseconds.

Everything else behaves the same: the descriptors it builds are the ones the processor would have generated, so guards, interceptors, pipes, filters, validation, versioning and forwardRef all work, and a module written in one style can import a module written in the other.

Not covered on the start-up path today: the ORM and other processor-generated parts (entities, repositories, GraphQL schemas, microservice and WebSocket handlers). Use Kotlin or Java for those, or keep them in a Kotlin subproject that the Scala or Groovy application imports.

Choosing between Kotlin and Java

KotlinJava
nullable parameters are optionalString?@Nullable
parameter names in routesautomaticwrite @Param("id") / @Query("name") (Java does not keep names)
coroutinesyeshandlers are blocking (virtual threads make that cheap)
data classes and copy for entitiesyesclasses or records (relations are not supported on records)
extra build setupnonethe Kotlin Gradle plugin as a host for KSP

Both languages can live in the same project, and a library written in one can be used from the other.

Read more