Registry / web-framework / 0http
library4.4.0jsnpmunverified

0http is a high-performance HTTP request router and server framework for Node.js, designed for high throughput and minimal overhead. Currently stable at version 4.4.0, the project maintains an active release cadence with frequent updates focused on performance, security, and Node.js compatibility. Key differentiators include its "zero friction" philosophy, highly customizable routing, and optimized Node.js HTTP server, often benchmarked among the fastest Node.js frameworks. It ships with full TypeScript type definitions since v3.5.0 and requires Node.js v22.x or higher, ensuring it leverages the latest runtime features and performance improvements.

npm install 0http
INSTALL
IMPORT
SIG · 0HTTP
0
0http
web-frameworkjavascriptv4.4.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cero
import cero from '0http';
const cero = require('0http');
While the README initially shows `require()`, modern Node.js environments (v22+ required) often use ESM. The `cero()` function is a factory that returns an object containing `router` and `server` instances.
{ router, server }
import cero from '0http'; const { router, server } = cero();
import { router, server } from '0http';
The `router` and `server` instances are obtained by calling the `cero()` factory function, not by direct named import from the package root.
Request, Response, Router, Server (types)
import type { Request, Response, Router, Server } from '0http';
import { Request, Response, Router, Server } from '0http';
When using TypeScript, use `import type` for importing only type definitions to avoid importing values at runtime. Types are available since v3.5.0.

Initializes a 0http server and router, handling a basic GET request and a POST request with body parsing, listening on port 3000.

import cero from '0http'; const { router, server } = cero(); router.get('/hello', (req, res) => { res.setHeader('Content-Type', 'text/plain'); res.end('Hello World!'); }); router.post('/submit', (req, res) => { let body = ''; req.on('data', chunk => { body += chunk; }); req.on('end', () => { console.log('Received:', body); res.statusCode = 201; res.setHeader('Content-Type', 'text/plain'); res.end('Data received successfully!'); }); }); server.on('error', (err) => { console.error('Server error:', err); }); server.listen(3000, () => { console.log('0http server listening on http://localhost:3000'); });
Debug
Known issues
breakingNode.js v22.x or higher is now required. Older Node.js versions (below v22.x) are not supported since `0http@4.4.0` (and v20.x was required since `0http@4.2.0`).
fix
Upgrade your Node.js runtime to version 22.x or later.
affects: >=4.4.0
breakingThe underlying `trouter` module was updated to v4 in `0http@4.0.0`. This may introduce breaking changes in how routes are defined, matched, or how parameters are handled.
fix
Review the `trouter` v4 changelog and documentation for any necessary adjustments to your routing logic.
affects: >=4.0.0
gotchaVersions prior to `0http@4.3.0` had potential issues with asynchronous middleware error handling, leading to unhandled exceptions or incorrect behavior.
fix
Upgrade to `0http@4.3.0` or higher to benefit from improved async middleware error fixes.
affects: <4.3.0
gotchaEnhanced error handler security was introduced in `0http@4.4.0`. Older versions might have had less robust error handling, potentially exposing sensitive information or being vulnerable to certain attacks.
fix
Upgrade to `0http@4.4.0` or higher to utilize the enhanced error handler security features.
affects: <4.4.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Attempting to use CommonJS `require()` syntax in an ES module context when Node.js is configured for ESM.
fix
Change `const cero = require('0http');` to `import cero from '0http';` and ensure your `package.json` has `"type": "module"` or your file uses the `.mjs` extension.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax in a CommonJS context when Node.js is configured for CJS.
fix
Change `import cero from '0http';` to `const cero = require('0http');` or configure your project for ESM by adding `"type": "module"` to `package.json` or using `.mjs` file extensions.
TypeError: cero is not a function
You are trying to use `cero` as a variable or object directly, but it is a factory function that needs to be called to instantiate the router and server.
fix
Ensure `cero` is called as a function: `const { router, server } = cero();`.
TypeError: Cannot read properties of undefined (reading 'get')
The `router` object was not correctly destructured or instantiated from the `cero()` factory function, or `cero()` was not called at all.
fix
Verify that `const { router, server } = cero();` is correctly executed and that `router` is in scope before attempting to define routes.
Upgrade
Version history
4.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
87 hits · last 30 days
node
77
OpenAI (training)
1
Resources
0http — npm install 0http · libregistry