npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@logbrew/node

v0.1.0

Published

Node.js HTTP helpers for the public LogBrew JavaScript SDK.

Downloads

30

Readme

@logbrew/node

Node.js HTTP helpers for the public LogBrew JavaScript SDK.

This package is intentionally thin. It adds a wrapper for standard node:http handlers, request/error event helpers, and request-local req.logbrew context while keeping event validation, retry, flush, and shutdown behavior in @logbrew/sdk.

Install

npm install @logbrew/sdk @logbrew/node
pnpm add @logbrew/sdk @logbrew/node

HTTP Server

import { createServer } from "node:http";
import { createNodeFetchTransport, withLogBrewHttpHandler } from "@logbrew/node";

const transport = createNodeFetchTransport();

const server = createServer(withLogBrewHttpHandler((req, res, logbrew) => {
  logbrew.client.log("evt_log_001", new Date().toISOString(), {
    message: `${req.method} ${req.url}`,
    level: "info",
    logger: "node"
  });
  res.end("ok");
}, {
  serverApiKey: "LOGBREW_SERVER_API_KEY",
  transport
}));

server.listen(3000);

withLogBrewHttpHandler() attaches req.logbrew, can capture completed requests from finish, captures thrown or rejected handler errors, and sends a plain 500 fallback when the app has not already written a response. Pass captureRequests: false when the app wants to record only its own explicit events.

Use serverApiKey directly for local server examples, or set LOGBREW_SERVER_API_KEY in your server environment and omit it. apiKey and LOGBREW_API_KEY are still accepted for compatibility with the lower-level JavaScript SDK. Automatic request and error metadata records the path without query text by default.

When an incoming request has a valid W3C traceparent header, the default request capture records the request as a LogBrew span that continues the incoming trace. Requests without traceparent, or with a malformed header, fall back to the existing request log event so bad client headers do not break your server. Use spanIdFactory when tests or edge runtimes need deterministic child span IDs:

const server = createServer(withLogBrewHttpHandler((req, res) => {
  res.end("ok");
}, {
  serverApiKey: "LOGBREW_SERVER_API_KEY",
  spanIdFactory: () => "b7ad6b7169203331",
  transport
}));

HTTP Delivery

createNodeFetchTransport() sends batches with Node's built-in fetch, sets content-type: application/json, and passes the SDK key through the authorization header. Override endpoint, headers, or fetchImpl when you need a proxy, local collector, or test double:

import { createNodeFetchTransport } from "@logbrew/node";

const transport = createNodeFetchTransport({
  endpoint: "https://api.logbrew.com/v1/events",
  headers: {
    "x-logbrew-source": "checkout-api"
  }
});

Packaged Examples

After install, these commands are available from a consumer app:

node node_modules/@logbrew/node/examples/index.mjs --help
node node_modules/@logbrew/node/examples/index.mjs --list
node node_modules/@logbrew/node/examples/index.mjs readme-example
node node_modules/@logbrew/node/examples/index.mjs real-user-smoke
node node_modules/@logbrew/node/examples/index.mjs
npm --prefix node_modules/@logbrew/node/examples run help
npm --prefix node_modules/@logbrew/node/examples run list
npm --prefix node_modules/@logbrew/node/examples run readme-example
npm --prefix node_modules/@logbrew/node/examples run real-user-smoke

The default launcher path runs real-user-smoke.