The fastest way to build HTTP services with Bun. Zero config, maximum performance.
Built for developers who demand performance without sacrificing developer experience
Optimized specifically for Bun's runtime with minimal overhead. Direct use of Web APIs and efficient routing based on the proven trouter library delivers sub-millisecond request handling.
Full TypeScript support with comprehensive type definitions for all APIs. Enjoy excellent IDE autocomplete, type safety, and inline documentation as you build.
Clean, intuitive API inspired by Express but built for modern runtimes. Get started in seconds without sacrificing power, flexibility, or performance.
Flexible async/await middleware system. Built-in support for CORS, JWT auth, rate limiting, body parsing, Prometheus metrics, and structured logging. Optional dependencies keep your bundle lean.
Lightweight framework with minimal dependencies and intelligent caching. Memory-efficient design with route caching and object reuse to minimize allocations and maximize throughput.
Built entirely on standard Web APIs (Request/Response). Write portable code that works across Bun, Deno, Cloudflare Workers, and other modern runtimes. No vendor lock-in.
Production-ready HTTP server with full TypeScript support and middleware
// Install: bun add 0http-bun
import http, { ZeroRequest, StepFunction } from '0http-bun'
import { createCORS, createLogger, createRateLimit } from '0http-bun/lib/middleware'
// Create router with error handling
const {router} = http({
errorHandler: (err: Error) => Response.json({error: err.message}, {status: 500})
})
// Apply middleware stack
router.use(createCORS()) // CORS support
router.use(createLogger()) // Request logging
router.use(createRateLimit({max: 100})) // Rate limiting
// Define routes with full type safety
router.get('/api/users/:id', async (req: ZeroRequest) => {
return Response.json({
id: req.params.id,
name: 'John Doe'
})
})
router.post('/api/users', async (req: ZeroRequest) => {
const body = await req.json()
return Response.json({created: true, data: body}, {status: 201})
})
// Start server
Bun.serve({ port: 3000, fetch: router.fetch })
Production-ready middleware for common use cases. Install only what you need.
Automatic parsing of JSON, form data, and text payloads with configurable size limits and error handling.
Flexible Cross-Origin Resource Sharing with support for credentials, custom headers, and preflight caching.
Secure JSON Web Token authentication with role-based authorization, token validation, and custom claims support.
Export HTTP metrics for monitoring and alerting. Track request rates, latencies, and error rates out of the box.
Flexible rate limiting with sliding window support. Protect your APIs from abuse with customizable limits per IP or key.
Structured request logging with multiple output formats. Built on Pino for high-performance logging in production.
Leveraging Bun's speed with developer-friendly APIs