How getsentry/sentry-javascript works
Project type and purpose
• This is an open‑source monorepo (managed by Lerna/Nx + Yarn Workspaces) hosting the Official Sentry SDKs for JavaScript.
• Purpose: publish a family of platform‑specific SDKs (browser, node, React, Angular, Next.js, etc.) plus shared core libraries and test harnesses.
High‑level components
a. Root Workspace
• Contains global configuration: lerna.json, nx.json, package.json, tsconfig.json, .github workflows, docs/, scripts/.
• Orchestrates multi‑package build, test, and release via GitHub Actions and custom scripts.
b. packages/
• “@sentry/core”: base SDK interfaces, envelope builder, transport abstractions, event processing, tracing engine.
• “@sentry/browser”, “@sentry/node”, “@sentry/react”, etc.: high‑level platform SDKs.
• Shared packages: browser‑utils (web vitals, instrumentation wrappers), integration‑shims, types, profiling, cloudflare, aws‑serverless, deno, bun, etc.
c. dev‑packages/
• E2E and unit test harnesses: Playwright and custom fixtures for browser integration tests (dev‑packages/browser‑integration‑tests).
• node‑integration‑tests: scripts and scenarios for server‑side SDK tests.
• bundle‑analyzer‑scenarios, clear‑cache‑GH‑actions, external‑contributor actions, size‑limit actions.
d. docs/
• Markdown guides for contributors, platform support, migration, architecture notes.
e. CI/CD pipeline
• .github/workflows: build, test, lint, code‑scanning (CodeQL), auto‑release, canary deploys, cache management.
Relationships and interactions
• Each platform SDK in packages/ imports from @sentry/core and often from browser‑utils or integration‑shims.
• Shared utilities flow “downward” (core → higher‑level SDKs).
• dev‑packages and packages/*/test drive test suites; they depend on built output of packages/*.
• scripts/ and .github/actions define build/test/publish pipelines that operate on all packages.
• Git tags/trunk trigger publishing each package to npm with proper versioning.
Architectural patterns and design principles
• Monorepo with workspace‑level orchestration (Lerna/Nx, Yarn Workspaces).
• Modular “package per responsibility” pattern—each SDK and utility is its own npm package.
• Shared core fosters consistency and DRY across SDKs; extension via integration‑shims.
• CI pipeline enforces reproducible builds, automated releases, and e2e matrix testing across JavaScript frameworks.
Technologies, frameworks, libraries
• TypeScript for source and definitions.
• Rollup + Vite for bundling and ESM/CJS outputs.
• Jest/Vitest for unit tests and Playwright for browser e2e.
• GitHub Actions for CI workflows and release automation.
• CodeQL, Dependabot, Dependabot‑review, and size‑limit for quality and security.
b. Inside, partition into:
• "packages/" (group of sub‑containers for core, browser, node, framework SDKs, shared utils)
• "dev‑packages/" (test harnesses and CI actions)
• "docs/" + "scripts/" + ".github/"