Zero friction HTTP
framework for Node.js

Tweaked for high throughput, low overhead, and maximum flexibility. The router that doesn't get in your way.

88K+
req/sec
<1ms
overhead
2
router engines
97.7%
test coverage
v5.0
latest

Why 0http?

A framework designed for developers who want speed without ceremony.

Blazing Fast

One of the fastest Node.js web frameworks. Smart LRU caching and efficient routing keep overhead near zero.

🎛

Highly Configurable

Swap routers, servers, and customize every behavior. You're in full control of the stack.

🔗

Middleware Engine

Express-like chain with full async/await support. Global or route-specific — your call.

Minimal, Fast, Secure

Three runtime dependencies. Zero bloat. Every line is optimized for raw throughput — smaller surface, fewer vectors, more speed.

🧩

Nested Routing

Modular architecture with nested routers. Static paths optimized for maximum performance.

🛡

Production Ready

Safe-by-default error handler, prototype pollution protection, and secure routing. Built for the real world.

Core Capabilities

Everything you need, nothing you don't.

1. Pluggable Routers

0http lets you define the router implementation you prefer. Two engines ship by default.

Sequential Router (Default)

Extended trouter with middleware, nested routers, and regex matching. Uses internal LRU cache for blazing-fast repeated lookups.

  • Supports GET, HEAD, PATCH, OPTIONS, CONNECT, DELETE, TRACE, POST, PUT
  • Configurable cache size — 0 to disable, negative for unlimited

Find-My-Way Router

Integration with find-my-way, a radix-tree router for maximum static path performance.

  • Best for static paths and high throughput without regex overhead
  • Does not support all middleware features of the sequential router

2. Middleware Engine

Optimized for both performance and flexibility. Global middleware, route-level middleware, and full async/await support — all in a minimal execution loop.

3. Nested Routers

Organize your application with modular nested routers. 0http optimizes static nested routes with direct slicing — zero regex overhead where it counts.

4. Custom Servers

Server-agnostic. Use standard http.Server, https.Server, or your own implementation. 0http just needs an event emitter.

Get Started

One command and you're running.

$ npm install 0http Copied!

Quick Start

Common patterns to get you moving fast.

basic-server.js
const { router, server } = require('0http')()

router.get('/hello', (req, res) => {
  res.end('Hello World!')
})

server.listen(3000)
json-api.js
router.get('/api/users', (req, res) => {
  res.setHeader('Content-Type', 'application/json')
  res.end(JSON.stringify({
    users: [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]
  }))
})
middleware.js
// Global logger
router.use((req, res, next) => {
  console.log(`${req.method} ${req.url}`)
  return next()
})

// Route-level auth
router.get('/admin', auth, (req, res) => {
  res.end('Welcome, admin')
})
async-handler.js
router.get('/users/:id', async (req, res) => {
  const user = await db.findById(req.params.id)
  if (!user) {
    res.statusCode = 404
    return res.end('Not found')
  }
  res.setHeader('Content-Type', 'application/json')
  res.end(JSON.stringify(user))
})
nested-routers.js
const { router: api } = require('0http')()

api.get('/users', getUsers)
api.post('/users', createUser)

// Mount at /api
router.use('/api', api)
error-handler.js
const { router, server } = require('0http')({
  errorHandler: (err, req, res) => {
    console.error(err)
    res.statusCode = 500
    res.end('Internal Server Error')
  }
})

router.get('/broken', () => {
  throw new Error('Oops!')
})

Configuration

Pass an options object to zero(config) — everything is optional.

OptionDescriptionDefault
routerCustom router instancesequential()
serverCustom server instancehttp.createServer()
defaultRouteHandler for 404 Not Found404 + res.end()
errorHandlerGlobal error handlerSafe-by-default (v5.0+)
prioRequestsProcessingUse setImmediate for priority processingtrue
cacheSizeLRU cache size (0=off, <0=unlimited)−1