Skip to content
forked from http4k/http4k

The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services.

License

Notifications You must be signed in to change notification settings

ollieabbey/http4k

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


http4k logo

build download GitHub license codebeat awesome kotlin Kotlin Slack back us! sponsor us!


http4k is a lightweight but fully-featured HTTP toolkit written in pure Kotlin that enables the serving and consuming of HTTP services in a functional and consistent way. http4k applications are just Kotlin functions. For example, here's a simple echo server:

val app: HttpHandler = { request: Request -> Response(OK).body(request.body) }
val server = app.asServer(SunHttp(8000)).start()

http4k consists of a lightweight core library, http4k-core, providing a base HTTP implementation and Server/Client implementations based on the JDK classes. Further servers, clients, serverless, templating, websockets capabilities are then implemented in add-on modules. http4k apps can be simply mounted into a running Server, Serverless platform, or compiled to GraalVM and run as a super-lightweight binary.

You can read about the rationale and ethos of http4k here

Sounds cool! Where can I find out more?

You can find out all about the project on the http4k site.

Installation

dependencies {
    // install the platform...
    implementation(platform("org.http4k:http4k-bom:5.32.4.0"))

    // ...then choose any moduless but at least the core
    implementation("org.http4k:http4k-core")
}

Quickstart

Bored with reading already and just want to get coding? Read the quickstart or take a look at the examples repo, which showcases a variety of http4k use-cases and features.

Module feature overview

If you're needed it to build an HTTP application, there's an excellent chance that http4k has a module for it. Check out the reference guide sections for details on the over 65 different built in integrations. Here's a selection:

  • Seamless app running in all these runtimes:
    • Server: 8 server integrations including Jetty, Helidon, Undertow and Ktor
    • Servlets: Plug into any HTTP Servlet container
    • Serverless: Support for 6 platforms including AWS Lambda, GCP, Alibaba and Azure
    • Custom Lambda runtime: For running performance sensitive AWS Lambdas without the overhead of the AWS runtime
    • Native: http4k apps can compile to GraalVM with no changes or configuration
    • In-memory: Running apps in a JVM for lightning fast tests
    • Realtime: WebSockets and Server Sent Events (SSE)
  • OpenAPI: Document your APIs with industry leading support
  • Protocol formats: Support for lots of protocol formats including JSONRpc, Graphql
  • Pluggable wire format integrations for: JSON, YAML, CSV, XML, DataFrame
  • Clients are available for these technologies:
    • HTTP: 6 clients including Apache, Jetty and OkHttp
    • WebSocket & SSE: For realtime connectivity
  • Observability: Measure http4l with integrations including OpenTelemetry and Micrometer
  • Metrics: Protect your app with Resilience4k and Failsafe
  • Security: Seamless OAuth and Digest integrations
  • HTML Templating: 7 serverside rendering engines including Handlebars, Pug4J and Rocker
  • Testing styles: Support for innovative testing techniques such as TracerBullet, Approval and Chaos testing
  • Testing Integrations: Battle harden your apps with integrations for WebDriver, Playwright, KoTest and others

Acknowledgments

  • Dan Bodart's utterlyidle
  • Ivan Moore for pairing on the original hackday project - Barely Magical.
  • You can see the amazing people and companies who have helped us to make http4k here.

About

The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 97.9%
  • Java 1.4%
  • HTML 0.5%
  • Shell 0.1%
  • Handlebars 0.1%
  • Pug 0.0%