A very light-weight (lite) non-blocking http framework for Kotlin coroutines.
Inspired by SparkJava, Jooby, etc, but smaller, simpler and better.
- Proper Kotlin coroutine support with working before/after filters for e.g. transactions and logging
- Minimal amount of code
- Simple to maintain & change
- Performance is also important, but simplicity is preferred
- Zero dependencies - Java built-in jdk.httpserver is used under the hood
- Perfect for microservices
- But still possible to replace with something else
- 12-factor apps by default
- Most behaviour can be overridden if necessary
- Both route builder and annotated classes
- Very easy to do simple things, e.g.
@GET suspend fun route() = provider.fetchData()
- Java 6+ built-in non-blocking jdk.httpserver
- Re-routable Java 9+ System.Logger
- server - the main server module. See it's docs. Zero external dependencies.
- jackson - adds json parsing/rendering using Jackson
- slf4j - redirects server logs to slf4j and configures it
- jdbc - provides jdbc extensions and transaction handling (depends on slf4j because of Hikari)
- jdbc-test - provides a way of testing your DB code using a real DB
See sample subproject on how to build apps with Klite and run them in Docker.
Klite builds are available from jitpack:
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
dependencies {
val kliteVersion = "master-SNAPSHOT" // you can put a released tag or commit hash here
implementation("com.github.angryziber.klite:server:$kliteVersion")
implementation("com.github.angryziber.klite:jackson:$kliteVersion")
implementation("com.github.angryziber.klite:jdbc:$kliteVersion")
testImplementation("com.github.angryziber.klite:jdbc-test:$kliteVersion")
...
}