H3 (framework)
js, serverless, and edge/Web-standard runtimes as the low-level foundation that higher-level tools like Nitro build upon.
Definition
H3 is a minimal, fast, and portable HTTP server framework for JavaScript/TypeScript maintained by the UnJS team, designed to run consistently across Node.js, serverless, and edge/Web-standard runtimes as the low-level foundation that higher-level tools like Nitro build upon.
Overview
H3 (short for "HTTP", stylized as a nod to compactness) is a lightweight HTTP framework built around the principle of runtime portability: rather than being tied to Node.js's specific `http` module APIs, H3 is designed to work across Node.js, Deno, Bun, Cloudflare Workers, and any environment supporting the Web-standard Fetch API's Request/Response objects. This makes H3 an ideal low-level building block for tools that need to run identically across many different JavaScript hosting environments, which is precisely why the Nuxt/UnJS team built Nitro on top of H3 as its core HTTP handling layer. H3's API surface is intentionally small and composable: it provides utilities for defining route handlers, reading request bodies and query parameters, setting response headers and status codes, and composing middleware, all through simple functions rather than a large class-based framework API. Its minimalism keeps bundle size small, which matters significantly for serverless and edge deployments where cold-start time and bundle size directly affect cost and latency. Despite its small footprint, H3 supports common needs like CORS handling, cookie parsing, static file serving, and WebSocket upgrades through its utility functions and a plugin-friendly design. Most developers interact with H3 indirectly through Nitro (and by extension, Nuxt), rather than using it as a standalone framework for typical application development, though it can be used directly for building extremely lightweight, portable HTTP services or serverless functions. Its design philosophy — small core, Web-standard APIs, and universal runtime compatibility — reflects a broader trend in the JavaScript ecosystem (shared with tools like Hono) toward frameworks that aren't locked to any single deployment target, in contrast to more traditional Node.js-specific frameworks like Express.
Key Features
- Minimal, composable HTTP framework built on Web-standard Request/Response
- Runs consistently across Node.js, Deno, Bun, and edge/serverless runtimes
- Small bundle size optimized for fast serverless/edge cold starts
- Core HTTP layer underlying the Nitro server toolkit
- Function-based route handler and middleware composition
- Built-in utilities for CORS, cookies, and static file serving
- WebSocket upgrade support through its plugin-friendly design
- Part of the broader UnJS ecosystem of universal JavaScript tooling