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

brainzlab-js

v0.1.0

Published

BrainzLab browser SDK — front-end observability (reflex errors, recall logs, pulse RUM) for the BrainzLab fleet.

Readme

brainzlab-js

BrainzLab browser SDK — front-end observability for the BrainzLab fleet. The JavaScript counterpart to the brainzlab Ruby gem:

| Module | Product | Captures | |--------|---------|----------| | reflex | reflex.brainzlab.ai | uncaught errors, promise rejections, React render errors, manual captureException | | recall | recall.brainzlab.ai | logs (log()) + optional console.* capture | | pulse | pulse.brainzlab.ai | Core Web Vitals (LCP/CLS/FID), navigation timing, fetch/XHR network timing | | flux | flux.brainzlab.ai | custom events (trackEvent) + metrics (trackMetric) |

Zero runtime dependencies. ~5 KB gzipped core. SSR-safe (no-ops outside the browser).

Install

npm install brainzlab-js

Quick start

import * as BrainzLab from "brainzlab-js";

BrainzLab.init({
  environment: "production",
  release: import.meta.env.VITE_APP_VERSION,
  appName: "roepa-admin",
  // PUBLIC, write-only ingest keys — safe to ship in browser code.
  // (sk_live_* secret keys are rejected by the browser endpoints.)
  reflex: { ingestKey: "rfx_ingest_xxx" },
  recall: { ingestKey: "rcl_ingest_xxx" },
  pulse:  { ingestKey: "pls_ingest_xxx" },
  flux:   { ingestKey: "flx_ingest_xxx" },

  sampleRate: 1,        // fraction of sessions for recall/pulse (errors + flux always sent)
  captureConsole: true, // mirror console.* → recall
  captureNetwork: true, // fetch/XHR timing → pulse
});

Configure only the products you have keys for — each is optional.

API

BrainzLab.captureException(err, { feature: "checkout" }); // → reflex
BrainzLab.log("warn", "low stock", { sku });               // → recall
BrainzLab.trackEvent("offer.published", { offerId, plan }); // → flux event
BrainzLab.trackMetric("cart.value", 289000, { currency: "USD" }); // → flux metric
BrainzLab.setUser({ id: 42, email: "[email protected]" });           // attached to events
BrainzLab.flush();                                          // force-send buffered events

React

import { ErrorBoundary } from "brainzlab-js/react";

<ErrorBoundary fallback={(err) => <Crashed error={err} />}>
  <App />
</ErrorBoundary>

window.onerror doesn't catch React render errors — the ErrorBoundary does, and forwards them to reflex with the component stack.

How it protects performance

  • Async + batched. Events are buffered per product and flushed on a 5s timer, when a batch fills, or with fetch({ keepalive }) / sendBeacon when the page is hidden — never on the critical path.
  • Preflight cached 24h. The cross-origin CORS preflight is cached, so steady state is a single background POST every few seconds.
  • Sampling. sampleRate throttles recall/pulse volume; errors are always kept.
  • Safe by default. No-ops on SSR and on dev hosts (unless enableInDevelopment).

Auth model

Browser code must never hold a secret key. Each product issues a public, write-only *_ingest_* key (like a Sentry DSN); the endpoints validate the origin and reject sk_live_*. Provision ingest keys per project in the product console (or via the brainzlab gem provisioners).

Endpoint contract

OPTIONS {host}/api/v1/browser            # CORS preflight
POST    {host}/api/v1/browser            # { events: [...], context: {...} }
  Authorization: Bearer <*_ingest_* key>
  X-BrainzLab-Session: <session id>