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

@vibemonitor/reactjs

v0.1.0

Published

Vibemonitor SDK for React apps (Vite, CRA, plain React). Thin wrapper around @vibemonitor/browser.

Readme

@vibemonitor/reactjs

Vibemonitor SDK for React SPAs — Vite + React, Create React App, or any React app that runs entirely in the browser (no SSR).

For Next.js, use @vibemonitor/nextjs instead — it handles the multi-runtime setup Next.js needs.


Installation

npm install @vibemonitor/reactjs

Pulls in @vibemonitor/browser + @vibemonitor/core transitively.


Environment variable

Vite (recommended for new React apps)

# .env or .env.local
VITE_VIBEMONITOR_API_KEY=vmsdk_xxx

Create React App

# .env or .env.local
REACT_APP_VIBEMONITOR_API_KEY=vmsdk_xxx

Get your token from the Vibemonitor dashboard → Settings → API Keys.


Setup — single file, single init()

React SPAs run in the browser only. One initialization at app startup is all you need.

Vite + React

// src/main.tsx
import vibemonitor from "@vibemonitor/reactjs";

vibemonitor.init({
  apiKey: import.meta.env.VITE_VIBEMONITOR_API_KEY,
  service: "my-react-app",
  environment: import.meta.env.MODE,
});

import { createRoot } from "react-dom/client";
import App from "./App";
createRoot(document.getElementById("root")!).render(<App />);

Create React App

// src/index.tsx
import vibemonitor from "@vibemonitor/reactjs";

vibemonitor.init({
  apiKey: process.env.REACT_APP_VIBEMONITOR_API_KEY!,
  service: "my-react-app",
  environment: process.env.NODE_ENV,
});

import ReactDOM from "react-dom/client";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root")!);
root.render(<App />);

Plain React (via <script> tag)

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import vibemonitor from "https://cdn.jsdelivr.net/npm/@vibemonitor/reactjs/+esm"
    vibemonitor.init({ apiKey: "vmsdk_xxx", service: "my-app" })
  </script>
</head>
<body><div id="root"></div></body>
</html>

What gets captured

Three layers run automatically after init():

  1. Explicit APIvibemonitor.log("INFO", "message", { attrs }) from anywhere in your code
  2. Console wrapconsole.log/info/warn/error/debug calls (React's dev warnings, third-party library logs, your own code)
  3. Global errors — uncaught exceptions (window.onerror) and unhandled promise rejections

Manual structured events

import { log } from "@vibemonitor/reactjs";

function CheckoutButton({ user, amount }) {
  const handleClick = async () => {
    try {
      await api.charge({ amount });
      log("INFO", "Checkout completed", {
        userId: user.id,
        amount,
      });
    } catch (err) {
      log("ERROR", "Checkout failed", { userId: user.id, err });
    }
  };

  return <button onClick={handleClick}>Buy</button>;
}

Configuration reference

vibemonitor.init({
  // Required
  apiKey: "vmsdk_xxx",

  // Identification
  service: "my-react-app",        // defaults to window.location.hostname
  environment: "production",       // "development" / "staging" / "production"
  version: "1.2.3",

  // Endpoint — default is production; override for local testing
  endpoint: "http://localhost:8000/api/v1/ingest/logs",

  // Master switches
  enabled: true,                   // false → SDK is a no-op
  debug: false,                    // true → emit [vibemonitor] stderr diagnostics

  // Transport tuning
  flushIntervalMs: 2000,           // flush every 2 sec
  maxQueueSize: 1000,              // drop oldest when full
  batchSize: 50,                   // flush when batch fills

  // Capture layers
  captureConsole: true,
  captureGlobalErrors: true,

  // PII scrubbing (redacts emails/tokens/OAuth codes before send)
  scrubPatterns: ["email", "jwt", "oauth_code", ...],
  customScrubPatterns: { myPattern: /.../ },

  // Hook to mutate or drop entries before send
  beforeSend: (entry) => entry,    // return null to drop
});

Best practices

Disable in tests / CI

vibemonitor.init({
  apiKey: import.meta.env.VITE_VIBEMONITOR_API_KEY,
  enabled: import.meta.env.MODE !== "test",
});

Or via env:

# .env.test
VITE_VIBEMONITOR_ENABLED=false

Wrap in a createLogger helper

If you want structured logging with module context, wrap the SDK:

// src/lib/logger.ts
import vibemonitor from "@vibemonitor/reactjs";

export function createLogger(module: string) {
  return {
    info:  (msg: string, data?: Record<string, unknown>) =>
      vibemonitor.log("INFO", msg, { module, ...data }),
    error: (msg: string, data?: Record<string, unknown>) =>
      vibemonitor.log("ERROR", msg, { module, ...data }),
  };
}

// Usage
import { createLogger } from "@/lib/logger";
const log = createLogger("checkout");
log.info("Order created", { orderId });

Don't expose the token via console.log

The token goes into a NEXT_PUBLIC_*-style env var by design — it ships to the browser. Never log the token value in your code. Customers can inspect your bundle, but they shouldn't see the token echoed to the console.


Browser support

  • Chrome 90+, Firefox 113+, Safari 16.4+ — full support (gzip via native CompressionStream)
  • Older browsers — SDK falls back to uncompressed body; everything else still works
  • Web Workers — explicit log() calls queue and flush; global error handlers silently disabled (no window)

Relation to @vibemonitor/browser

@vibemonitor/reactjs is a thin re-export of @vibemonitor/browser — all implementation lives there. This package exists so your package.json matches your stack.

If you're using Vue, Svelte, Angular, or vanilla JS, install @vibemonitor/browser directly instead.

Future versions of @vibemonitor/reactjs may add a React Error Boundary component and hooks (useVibemonitor, etc.).


Shutdown

await vibemonitor.shutdown();

Automatic on page unload via navigator.sendBeacon. Call explicitly only for graceful teardown in tests.


License

Proprietary. See LICENSE.