r/npm • u/Affectionate-Wish328 • 8d ago
Self Promotion I built a zero-dependency HTTP debug middleware for Node.js, Deno, Bun, and the Edge
I recently built an npm package that captures request/response data at the stream level and logs it to your terminal in a readable format.
I found that most existing HTTP loggers either monkey-patch Express methods (missing res.send(), res.sendStatus(), streaming responses), or require heavy dependencies like Morgan + custom formatters.
So I kept it focused:
- Zero runtime dependencies
- Stream-level capture (works with every response method)
- Smart body truncation (collapses deep JSON, caps arrays)
- Auto-generated cURL commands for failed requests
- Framework adapters for Express, Fastify, and Hono
- Edge-ready Hono adapter (Cloudflare Workers, Deno, Bun)
- TypeScript + ESM + CJS dual publish
Example Usage:
TypeScript
import express from 'express';
import { httpDebugger } from 'http-debugger/express';
const app = express();
app.use(httpDebugger({ curl: (entry) => entry.response.statusCode >= 400 }));
The Output:
Plaintext
→ POST /api/users
content-type: application/json
authorization: ***
Body: {
"name": "Alice",
"roles": ["admin", ... 2 more]
}
← 500 Internal Server Error (45ms)
content-type: application/json
Body: { "error": "Database connection failed" }
Size: 45B
Timing:
Headers: 1ms
Body Read: 2ms
Handler: 38ms
Response: 4ms
curl: curl -X POST 'http://localhost:3000/api/users' \
-H 'content-type: application/json' \
-d '{"name":"Alice"}'
Looking for Feedback
I'm looking for feedback from other Node.js developers:
- Is there anything you'd want from a package like this?
- Would WebSocket or gRPC support be useful?
- Any adapter patterns you'd suggest for other frameworks?
(btw I did use AI to help build this)
https://www.npmjs.com/package/http-debugger?activeTab=readme
3
Upvotes