Draft Spec Proposes Unified Server-Side HTTP API for JS Runtimes
A draft spec proposes a unified server-side HTTP API using ServerContext to reconcile Node, Deno, Bun, and edge runtime differences.
Node.js, Deno, Bun, and Cloudflare Workers all build on Fetch's Request and Response for server-side HTTP, but they've diverged sharply on handler signatures, WebSocket upgrade flow, lifecycle management, and unmodeled features like trailers, informational responses, and extended CONNECT. This draft specification proposes a server-side API that closes those gaps without extending or subtyping the standard Fetch types.
The core idea is a separate ServerContext object that holds connection metadata, server capabilities, and lifecycle hooks like waitUntil — keeping the HTTP message itself clean while the processing environment lives elsewhere. The design depends on two proposed Fetch Standard additions currently before WHATWG: trailer support and an onInformation callback for informational responses.
The spec deliberately excludes routing, middleware, and response helper methods, leaving those to frameworks. It defines two conformance layers: a mandatory core handler model, and an optional infrastructure layer covering serve(), Server, and Listener — letting platform-managed runtimes like Cloudflare Workers and self-managed ones like Node.js both conform. The goal is portable handler code across runtimes and headroom for future protocols like WebTransport and HTTP Datagrams without breaking API changes.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work