$ show getsentry/sentry-javascript
This is the official Sentry JavaScript SDK monorepo, providing error monitoring, performance tracing, session replay, user feedback, and profiling for a wide range of JavaScript runtimes and frameworks. The architecture is a large monorepo with ~50 packages, each targeting specific platforms (browser, Node.js, Cloudflare Workers, Deno, Bun) and frameworks (Next.js, Angular, React, SvelteKit, Nuxt, etc.). The core SDK logic lives in `packages/core`, with platform-specific packages that integrate via a consistent `Sentry.init()` entry point. Data flows from the user's application through instrumented APIs (error handlers, fetch, timers, etc.) to produce events (errors, spans, breadcrumbs, replay recordings) that are serialized into envelopes and sent to Sentry's ingest endpoint via configurable transports. The monorepo also includes bundler plugins for build-time instrumentation (source map upload, debug ID injection, component annotation) and extensive integration tests covering multiple bundler versions and framework releases. The codebase exhibits high craftsmanship with well-defined integration patterns (`defineIntegration`), modular utilities, and comprehensive test infrastructure. It is actively maintained with frequent commits and a broad compatibility surface, though the sheer number of framework-specific packages introduces some maintenance complexity.
The LLM identified 3 files worth highlighting for reuse:
Provides configurable filtering of URL query parameters based on data collection behavior (allow/deny lists). This utility is self-contained and can be extracted into any JavaScript project that needs to sanitize or control query string data collection, demonstrating a clean separation of concerns and reusable data privacy logic.
Registers global error handlers (on error, unhandled rejection) to mark the active root span as failed. This is a simple but effective pattern for automatically correlating errors with the current trace. The logic is isolated and could be reused in any tracing system that needs to flag spans on unhandled exceptions.
Manages the session lifecycle for replay: loading existing sessions from storage or creating new ones with correct expiry and sampling decisions. The pattern of idempotent session load/create with fallback to default values is reusable across any application that needs to manage stateful user sessions with expiry.