http4k is an HTTP toolkit written in Kotlin that enables the serving and consuming of HTTP services in a functional and consistent way.
http4k applications are just Kotlin functions which can be mounted into a running backend.
The principles of http4k are:
- Application as a Function: Based on the Twitter paper "Your Server as a Function", all HTTP services can be composed of 2 types of simple function:
HttpHandler
,Filter
- Immutability: All entities in the library are immutable unless their function explicitly disallows this.
- Symmetric: The
HttpHandler
interface is identical for both HTTP services and clients. This allows for simple offline testability of applications, as well as plugging together of services without HTTP container being required. - Dependency-lite: Apart the from Kotlin StdLib, http4k-core module has ZERO dependencies and weighs in at ~700kb. Add-on modules only have dependencies required for specific implementation.
- Testability Built by TDD enthusiasts, so supports super-easy mechanisms for testing.
- Modularity: Common behaviours are abstracted into the
http4k-core
module, but there are several pluggable modules for different purposes.
Project website: https://www.http4k.org/
Github Project Organization: https://github.com/http4k