laminar
StableLightweight HTTP request pipeline library. Composable middleware, typed request context, and zero external dependencies.
Node.jsEdge RuntimeHTTPTypeScript
View on GitHublaminar is a 3kb HTTP pipeline library for Node.js and edge runtimes. It is deliberately minimal: no routing, no templating, just a clean composable middleware model with a fully typed context object.
Example
import { pipeline, compose } from 'laminar'
const logger = async (ctx, next) => {
console.log(`${ctx.method} ${ctx.url}`)
const res = await next(ctx)
console.log(`-> ${res.status}`)
return res
}
const auth = async (ctx, next) => {
if (!ctx.headers.authorization) {
return { status: 401, body: 'Unauthorized' }
}
return next({ ...ctx, user: parseToken(ctx.headers.authorization) })
}
const handler = compose(logger, auth, myRouteHandler)
export default pipeline(handler)
Design goals
- Zero dependencies — ships as pure ESM with no transitive deps
- Edge-first — runs on Cloudflare Workers, Vercel Edge, Deno Deploy
- Typed context — middleware can widen the context type; downstream handlers see the enriched type
Status
v1.2.1. Stable API. Actively maintained.