rollbar.js

The official cross-platform JavaScript SDK for Rollbar, capturing browser, Node.js, and React Native errors with breadcrumbs and session replay.

SDK
npm
v3.1.0
587stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
71/100Good
Development Activity40
Maintenance76
Community88
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture82
Code Quality85
Innovation68
Learning Curve75

rollbar.js is the official JavaScript client for Rollbar, the hosted error-monitoring and alerting platform. It wraps a single Notifier/Queue/RateLimiter core with platform-specific transports and defaults for the browser, Node.js, and React Native, so the same public API captures uncaught exceptions, unhandled promise rejections, and manually logged messages regardless of runtime.

Beyond capture, the SDK ships telemetry (breadcrumb-style event history leading up to an error), source-map-aware stack traces, payload scrubbing for sensitive fields, legacy OpenTracing-compatible tracing, and framework integrations for Express, Koa, Hapi, Next.js, React, Angular, and Vue. A newer Session Replay feature is distributed as a separate rollbar/replay bundle so teams that don’t need it keep the base install small.

What You Get

  • Automatic capture of uncaught exceptions and unhandled promise rejections in the browser, Node.js, and React Native
  • Telemetry breadcrumbs (DOM events, network requests, console logs, navigation) attached to every reported error for context
  • Source-map-aware stack trace deminification so minified production errors point back to original source lines
  • Optional Session Replay bundle (rollbar/replay) that records and replays the user session around an error
  • Payload scrubbing to redact sensitive fields (tokens, passwords, PII) before data leaves the client
  • Client-side rate limiting and configurable items-per-minute caps to control reporting volume
  • Framework middleware/integrations for Express, Koa, Hapi, Next.js, React, Angular, and Vue

Common Use Cases

  • Adding real-time crash/error reporting to a production browser single-page app
  • Instrumenting a Node.js/Express API server to capture and alert on unhandled server errors
  • Tracking JavaScript errors in a React Native mobile app alongside web error data in one Rollbar project
  • Replaying the user session around a reported error to reproduce hard-to-diagnose UI bugs
  • Enriching error reports with custom breadcrumbs and scrubbed payload data for compliance-sensitive apps

Under The Hood

Architecture The SDK centers on a Rollbar constructor (src/rollbar.js) that wires together a Notifier, a Queue, and a RateLimiter around a platform-specific api and transport. Each target platform (src/browser/rollbar.js, src/server/rollbar.js, src/react-native/rollbar.js) supplies its own defaults.js and transport.js while sharing the core notifier/queue/rate-limiter/transforms pipeline, so browser DOM instrumentation (globalSetup.js, domUtility.js, wrapGlobals.js) and Node.js middleware (src/server/middleware/) plug into the same reporting core rather than duplicating it. Telemetry (telemetry.js) and tracing (src/tracing/, with legacy OpenTracing compatibility) are layered on top as optional subsystems, and the Session Replay recorder lives in its own src/browser/replay/ module built on @rrweb/record, exported through a separate rollbar/replay entry point so it doesn’t bloat the default bundle.

Tech Stack The project is an ES module package ("type": "module") built with Webpack into UMD/CJS/ESM outputs under dist/, with an es-check-enforced ES5 validation pass on the shipped bundles to guarantee old-browser compatibility despite modern source. TypeScript type declarations (index.d.ts and per-module .d.ts files) ship alongside plain JS, Babel handles the ES5 downcompile, and runtime dependencies are deliberately minimal (async, error-stack-parser-es, json-stringify-safe, lru-cache, request-ip, source-map, plus @rrweb/record for replay).

Code Quality Testing is extensive and mirrors the source layout: test/browser.*.test.ts suites run under Web Test Runner (Mocha + Chai + Sinon, browser-executed via Playwright), test/server.*.test.js suites run under plain Mocha for Node, and test/replay/ carries dedicated unit and integration coverage for the session-replay recorder. ESLint (with a cyclomatic-complexity cap and an unused-imports rule enforced warning-free) plus Prettier formatting run in CI (ci.yml, workflow.yml) alongside tsc --noEmit type-checking for both source and tests, and a pre-publish validate script chains ES5 validation, example-snippet checks, and type-checking.

What Makes It Unique Most error-tracking SDKs bundle everything into one script; rollbar.js instead splits Session Replay into its own rollbar/replay entry so teams that don’t need session recording avoid the extra payload weight entirely. It also carries a legacy OpenTracing-compatible tracer alongside its own tracing module for teams migrating instrumentation, and validates every production bundle against the ES5 language target so the same package can be safely loaded via a <script> tag on older browsers as well as imported into modern bundler-based apps.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search