Features
- Tree-shakeable and ultra-lightweight
- Compatible with Node.js, Bun, Deno, and edge runtimes
- Composable utilities for request/response handling
- Built-in WebSocket and Server-Sent Events support
Pros
- Extremely small footprint with zero dependencies
- Powers Nitro and Nuxt server infrastructure
- Web standard compatible with adapters for any runtime
Cons
- Lower-level than most frameworks — less built-in structure
- Ecosystem awareness is lower than Express or Hono
- Better as a building block than a standalone framework
Overview
h3 (HTTP) is a minimal, composable HTTP framework from the UnJS ecosystem. It serves as the foundation for Nitro and Nuxt’s server engine, providing the low-level HTTP handling with a clean, utility-based API that works across all JavaScript runtimes.
h3 is designed to be tree-shakeable so you only ship the code you use. Its event-handler pattern is simple and composable, with utility functions for reading bodies, setting headers, handling cookies, and managing sessions.
When to Use
h3 is the right choice when building framework-level tooling, when you need the absolute minimum HTTP abstraction, or when contributing to the UnJS/Nuxt ecosystem. For application development, Nitro or Hono provide more structure on top of similar concepts.
Getting Started
npm install h3
import { createApp, createRouter, defineEventHandler } from "h3";
const app = createApp();
const router = createRouter();
router.get("/", defineEventHandler(() => {
return { message: "Hello from h3" };
}));
app.use(router);