Skip to content

Small packages for HTTP services on the Fetch API.

A router, a middleware pipeline and a handful of hardened primitives: errors, body readers, auth, logging, rate limits and retries. Each package solves one problem, can be used without the others, and runs unchanged on Cloudflare Workers, Node, Deno and Bun.
import { errorHandler, HttpError } from '@edgetime/http';
import { requestId, secureHeaders } from '@edgetime/middleware';
import { Router } from '@edgetime/router';
const app = new Router()
.use(requestId(), secureHeaders())
.get('/orders/:id', async (c) => {
if (c.params.id !== 'o_1') throw new HttpError(404, 'No such order');
return c.json({ id: c.params.id });
})
.onError(errorHandler());
export default { fetch: app.fetch };
  • A small, strict core. @edgetime/router matches requests, runs middleware, carries typed per-request values and turns anything thrown into a response. About 4 kB gzipped. See @edgetime/router.
  • Primitives that fail closed. Every package validates its settings when it is created, bounds what it reads and holds, and refuses the request when a guard’s callback throws. See Security defaults.
  • Portable by construction. Packages ask for the methods they call, not a vendor’s types, so a Cloudflare binding, a Node implementation and a test double all fit. See Patterns.
  • No framework to grow out of. Features are middleware, providers and extensions on public methods, written the same way the packages are. See Write an extension.