JavaScript & TypeScript — @newinstance/bugwatch

Install: npm install @newinstance/bugwatch · Node ≥ 20.19 · ESM · all framework deps are optional peers.

import { BugWatch } from "@newinstance/bugwatch";
BugWatch.init({
  projectKey: process.env.BUGWATCH_KEY!,   // sk_…KEYID:secret — server-side only
  release: process.env.APP_VERSION,
  environment: process.env.NODE_ENV,
});

Key options: projectKey (server) or sessionUrl (browser), release, environment, sampleRate (default 1), sensitiveFields, beforeSend, batchSize 50, flushInterval 5000 ms, maxQueueSize 1000, retry (3 attempts, exponential), traceContextProvider.

19 subpath exports., ./node, ./browser, ./react, ./vue, ./next, ./express, ./fastify, ./koa, ./hono, ./hapi, ./nest, ./pino, ./winston, ./bunyan, ./log4js, ./console, ./otel, ./testing.

Framework adapters: Express (bugWatchExpressRequestHandler / bugWatchExpressErrorHandler / bugWatchBrowserSessionHandler), bugWatchFastify, bugWatchKoa, bugWatchHono, createBugWatchHapiPlugin, Nest (BugWatchExceptionFilter, bugWatchNestMiddleware), Next.js (withBugWatchRouteHandler), React (BugWatchErrorBoundary), Vue (createBugWatchVuePlugin), loggers (Pino destination, Winston transport, Bunyan stream, log4js appender, captureConsole), OTel (otelTraceContextProvider).

Wire endpoints used: POST /api/v1/bugwatch/ingest (x-api-key, NDJSON, ≤5000 events/request), POST /api/v1/bugwatch/browser-session, POST /api/v1/bugwatch/ingest/browser (x-bugwatch-session).

Capabilities: error + structured log capture, redaction (defence-in-depth with server), sampling, bounded in-memory queue, OTel trace/span correlation. No breadcrumbs or session replay.

Browser rule: never ship projectKey to the client — use sessionUrl (see SDK Usage and Browser & Mobile).