The Functional toolkit for Kotlin HTTP applications

http4k provides a simple and uniform way to serve and consume HTTP services.

Quick Start

HTTP as a Function

Creating a server with http4k

An http4k server is just a regular function that gets invoked with a Request and returns a Response.

In a single line of code you can switch your server between Java (built-in), Apache, Jetty, Netty, Undertow, Ktor, or Ratpack.

Creating a client with http4k

An http4k client is just a regular function that you invoke with a Request and receives a Response.

In a single line of code you can switch your client implementation between Java (built-in), Apache, Jetty, and OkHttp.

Highlights

footprint

Tiny
footprint

The core library has no dependencies and it’s all you need to create fully-functional applications.

http4k APIs take advantage of Kotlin features and are powered by Functional Programming techniques.

extendable

Highly
extendable

Supports many Server, Serverless and HTTP Client technologies behind simple, consistent interfaces.

http4k provides 40+ pre-built integrations for developers to choose from including Operability, JSON, and OpenAPI support.

testability

First class
testability

Create lightning fast, rock solid test suites for individual endpoints, applications or multi-service systems, all running fully in-memory.

http4k embraces advanced testing approaches such as Approval, Chaos and Service Virtualization.

supportive

Battle-tested
in the wild

http4k takes advantage of technologies that have millions of hours of production runtime.

The toolkit has been used to build high volume applications in Banking, Publishing & Government projects.

Learn by example

The docs are based on real, runnable examples that you can just use to get started.

See cookbook

More than 40 integrations

http4k integrates with many tools and libraries for building Cloud-Native applications.

Check it out
amazon
dust
thymeleaf
amazon-lambda
monkey
jetty
open-api
apache
okhttp3
git
handlebars
undertow
gson
sun-microsystems
xml
netty

We love
our community

Many of the features of http4k have been added by its amazing contributors. New versions for features and fixes are released quickly and without fuss.

http4k had been designed to make it easy to contribute or get help when you need it.

Contribute

Some of our contributors

support

Getting Support

Sometimes everybody needs a little help. http4k provides several way to seek assistance, both through the community Slack channels and through bespoke support services.

faq

http4k in the wild

If you're looking for more complete examples http4k applications, look here. There are also a collection of public talks covering various aspects of the toolkit.

pumb