More Software Engineering Radio episodes

David Denton on http4k thumbnail

David Denton on http4k

Published 25 Nov 2026

Duration: 55:30

HTTP 4k is a functional Kotlin toolkit for web applications that enables fast, in-memory testing of entire systems by modeling servers and endpoints as simple, composable functions.

Episode Description

David Denton, co-creator of http4k, joins host Giovanni Asproni to talk about this lightweight toolkit for building HTTP applications in Kotlin. http4...

Overview

HTTP 4k is an HTTP toolkit for building web applications in Kotlin, created by David Danton. Rather than calling itself a framework, the project positions itself as a toolkit built on the "server as a function" concept from a 2013 Twitter paper, which models distributed systems as two types of simple functions: services (mapping a typed request to a response) and filters (decorators that wrap services). The toolkit was reimplemented in Kotlin from the original Scala-based Finagle project, simplified to operate purely over HTTP rather than a generic interface.

The core design philosophy emphasizes functional composition, testability, and simplicity. The entire server can be represented as a single function, enabling it to be tested completely in memory, deployed to serverless platforms, or attached to various JVM runtimes like Jetty, Netty, or Ktor. Clients and servers share the same interface, allowing a single test to target an endpoint, a server, or a third-party client with one line of code change. The toolkit supports over 220 modules, including adapters for AWS services, LLM providers, and in-memory fakes for services like DynamoDB.

HTTP 4k deliberately avoids annotations, reflection, and boilerplate, favoring visible, composable code. It supports pluggable backends, multiple format libraries (Jackson, Moshi, Kotlin serialization), and generates OpenAPI specifications directly from code to prevent documentation drift. The project is open source with roughly 95 percent of modules free, transitioning toward an open-core model with a small paid enterprise tier for supply-chain security.

What If

  • What if you replaced your current web framework with HTTP 4k for a new side project to test the in-memory composition model?

    • Move: Build a small API with three to four endpoints using HTTP 4k's service and filter abstractions, then write a single test that composes all endpoints in memory without starting a server or opening a network socket.
    • Why Now?: The speaker notes that every test run carries a cost in CI pipelines and that the London-school outside-in TDD approach yields "more bang for buck tests" with fewer test cases, which matters when you are maintaining a solo project with limited time.
    • Expected Upside: A proposal is that you could validate your entire API surface in milliseconds rather than seconds, reducing feedback loops during development and cutting CI runtime for a solo operator's pipeline.
  • What if you used HTTP 4k's in-memory fakes to eliminate Docker and local-stack dependencies from your local development workflow?

    • Move: For a project that talks to AWS services like S3 or DynamoDB, swap the real client adapters for HTTP 4k's stateful in-memory fakes and run your integration tests entirely within the JVM, reserving Testcontainers or real cloud calls for a nightly build.
    • Why Now?: The speaker describes waiting "like a minute" for DynamoDB tests locally versus 200 milliseconds for the fakes, and notes that serverless pricing penalizes slow cold starts and high memory usage.
    • Expected Upside: A possibility is that your local test suite drops from minutes to sub-second, removing Docker as a prerequisite for new contributors and reducing cloud spend during development.
  • What if you adopted the "specs from code" pattern to keep your OpenAPI documentation automatically in sync with your implementation?

    • Move: Define your API contracts using HTTP 4k's contract DSL with lenses for path parameters, headers, and body types, then generate the OpenAPI JSON from the code rather than maintaining a separate YAML file.
    • Why Now?: The speaker warns that the common pattern of writing a spec first and implementing later breaks "right up until the point the code changes and specification doesn't," creating mismatches that are costly to detect in production.
    • Expected Upside: A proposal is that your documentation can never drift from your code, and you can stub endpoints with dummy responses to share a contract with a consumer before the real implementation exists, lowering the risk of API design mistakes.

Takeaway

  • Build your next small API using HTTP 4k's service and filter functions so the entire server is a single composable function, enabling you to test it in memory without starting a runtime or opening a network port.
  • Replace Docker-based local dependencies (e.g., DynamoDB, S3) with HTTP 4k's in-memory fakes for your day-to-day test runs, reserving Testcontainers or real cloud calls for a nightly or pre-release pipeline.
  • Define your OpenAPI contracts in code using HTTP 4k's contract DSL and lenses, generating the specification from the implementation so documentation cannot drift from your endpoints.
  • Use the bridge modules to incrementally migrate an existing Spring, Micronaut, or Helidon service to HTTP 4k by mounting the new application behind a wildcard route and moving endpoints one at a time.
  • Evaluate whether your current framework's startup memory (often around a gigabyte) and cold-start time are inflating your serverless or fleet costs; a standard HTTP 4k service starts under 100 megabytes of heap, which directly reduces per-invocation billing.

Recent Episodes of Software Engineering Radio

29 Oct 2026 Danilo Krummrich on Rust in the Linux Kernel

"Nova GPU driver project integrates Rust into the Linux kernel to replace the aging Novo driver, leveraging Rust's memory safety for better reliability and performance while addressing firmware and architectural challenges through incremental, collaborative updates."

7 Oct 2026 Sahil Walia on Schema Changes and Data Migrations

Recommended: Schema as source of truth

"Schemas define data structure, apply across systems, and require careful evolution to avoid breaking changes, with best practices including additive updates, blue-green deployments, and stable identifiers."

30 Sept 2026 Raju Dandigam on Building Production AI Agents

"Explores production AI agents, their autonomy, safety, and engineering best practices, comparing workflows, tool design, orchestration, and memory systems while addressing challenges like cost, latency, and reliability."

16 Sept 2026 Milan Milanovic on the Laws of Software Engineering

"Explores key software engineering principles (like Conway's Law, Brooks' Law) and their impact on systems, teams, and decision-making, emphasizing context-dependent trade-offs, AI's role, and practical applications like measuring technical debt."

More Software Engineering Radio episodes

David Denton on http4k | Podcast Summarizer