{"_id":"@alby-sh/browser","name":"@alby-sh/browser","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@alby-sh/browser","version":"0.1.0","description":"Official Alby error-tracking SDK for browsers","keywords":["alby","error-tracking","monitoring","observability","crash-reporting","browser"],"homepage":"https://github.com/alby-sh/alby-sdk-browser","license":"MIT","author":{"name":"Alby","email":"info@alby.sh"},"repository":{"type":"git","url":"git+https://github.com/alby-sh/alby-sdk-browser.git"},"type":"module","main":"./dist/alby.cjs.js","module":"./dist/alby.esm.js","types":"./dist/alby.d.ts","browser":"./dist/alby.iife.js","unpkg":"./dist/alby.iife.js","jsdelivr":"./dist/alby.iife.js","exports":{".":{"types":"./dist/alby.d.ts","import":"./dist/alby.esm.js","require":"./dist/alby.cjs.js","browser":"./dist/alby.iife.js","default":"./dist/alby.esm.js"}},"scripts":{"build":"rollup -c","dev":"rollup -c -w","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","smoke":"node e2e/smoke.mjs","prepublishOnly":"npm run build"},"devDependencies":{"@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.0","jsdom":"^24.0.0","rollup":"^4.12.0","rollup-plugin-dts":"^6.1.0","tslib":"^2.6.2","typescript":"^5.3.0","vitest":"^1.2.0"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@alby-sh/browser@0.1.0","gitHead":"41833b8a1caa0f1ed406cb4229071dfec1516585","bugs":{"url":"https://github.com/alby-sh/alby-sdk-browser/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-wEo5J09ejfvVPmmHwnS/62MS99RKmAkbe6HI/Pfilhz17h/EBPPJbB+Z6BiHy/oZ7TAyYEwz0Zx8cj0TohRDLg==","shasum":"c17b9f207e7c27d5b701225df8fe019e28c29272","tarball":"https://registry.npmjs.org/@alby-sh/browser/-/browser-0.1.0.tgz","fileCount":11,"unpackedSize":178193,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alby-sh%2fbrowser@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGTHVeYBA1IOEnj5DYA1t10uFHY+pwdgMPLjPQeAeSFTAiAPYJeAbSsEk8WNt/Uz/kSU98shbEMJiNb5Wm0hAGVrtw=="}]},"_npmUser":{"name":"albertopisaroni","email":"a.pisaroni@truesolutions.io"},"directories":{},"maintainers":[{"name":"albertopisaroni","email":"a.pisaroni@truesolutions.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/browser_0.1.0_1776680057337_0.4604175557157133"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T10:14:17.251Z","0.1.0":"2026-04-20T10:14:17.478Z","modified":"2026-04-20T10:14:17.875Z"},"maintainers":[{"name":"albertopisaroni","email":"a.pisaroni@truesolutions.io"}],"description":"Official Alby error-tracking SDK for browsers","homepage":"https://github.com/alby-sh/alby-sdk-browser","keywords":["alby","error-tracking","monitoring","observability","crash-reporting","browser"],"repository":{"type":"git","url":"git+https://github.com/alby-sh/alby-sdk-browser.git"},"author":{"name":"Alby","email":"info@alby.sh"},"bugs":{"url":"https://github.com/alby-sh/alby-sdk-browser/issues"},"license":"MIT","readme":"# @alby-sh/browser\n\n[![npm version](https://img.shields.io/npm/v/@alby-sh/browser.svg?color=cb3837&logo=npm)](https://www.npmjs.com/package/@alby-sh/browser)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/@alby-sh/browser.svg?label=gzip)](https://bundlephobia.com/package/@alby-sh/browser)\n[![CI](https://github.com/alby-sh/alby-sdk-browser/actions/workflows/ci.yml/badge.svg)](https://github.com/alby-sh/alby-sdk-browser/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nOfficial [Alby](https://alby.sh) error-tracking SDK for web browsers. Tiny (< 10 KB gzipped IIFE),\nzero runtime dependencies, works with a `<script>` tag or any bundler.\n\n- Conforms to the [Alby Ingest Protocol v1](./PROTOCOL_V1.md).\n- Captures uncaught exceptions (`window.onerror`) and unhandled promise\n  rejections automatically.\n- Auto-breadcrumbs: `click`, `fetch`, `XMLHttpRequest`, `console.error/warn`,\n  `history` navigation.\n- `sendBeacon` fallback on page unload so last-second errors aren't lost.\n- Retry with exponential backoff (1s / 5s / 15s), respects `Retry-After`.\n- TypeScript types shipped.\n\n## Install\n\n```sh\nnpm install @alby-sh/browser\n```\n\nOr drop it on the page directly:\n\n```html\n<script src=\"https://unpkg.com/@alby-sh/browser/dist/alby.iife.js\"></script>\n<script>\n  Alby.init({\n    dsn: 'https://<PUBLIC_KEY>@alby.sh/ingest/v1/<APP_ID>',\n    release: '1.4.2',\n    environment: 'production',\n  })\n</script>\n```\n\n## Usage (npm)\n\n```js\nimport { Alby } from '@alby-sh/browser'\n\nAlby.init({\n  dsn: 'https://<PUBLIC_KEY>@alby.sh/ingest/v1/<APP_ID>',\n  release: '1.4.2',\n  environment: 'production',\n})\n\n// Manual capture\ntry {\n  doSomethingRisky()\n} catch (err) {\n  Alby.captureException(err)\n}\n\n// Scoped metadata\nAlby.setUser({ id: 'u_412', email: 'ada@example.com' })\nAlby.setTag('region', 'eu-west-3')\nAlby.setContext('app', { route: '/checkout' })\nAlby.addBreadcrumb({ category: 'auth', message: 'user signed in' })\n\n// Before navigating away / in SPAs:\nawait Alby.flush(2000)\n```\n\n## API\n\n| Method | Description |\n|---|---|\n| `Alby.init(options)` | Initialize the SDK. Required. |\n| `Alby.captureException(err, overrides?)` | Send an exception event. Returns the `event_id`. |\n| `Alby.captureMessage(msg, level?)` | Send a plain message event. |\n| `Alby.setUser({ id, email, name, ip_address })` | Attach a user to every future event. Pass `null` to clear. |\n| `Alby.setTag(key, value)` | Attach a low-cardinality string tag. |\n| `Alby.setContext(key, obj)` | Attach free-form context. Pass `null` to clear. |\n| `Alby.addBreadcrumb({ type, category, message, data })` | Append a breadcrumb (ring buffer, cap 100). |\n| `Alby.flush(timeoutMs?)` | Wait for the in-flight queue to drain. |\n\n## Options\n\n| Option | Type | Default | Notes |\n|---|---|---|---|\n| `dsn` | string | — | **Required.** `https://<PUBLIC_KEY>@<host>/ingest/v1/<APP_ID>` |\n| `release` | string | `''` | Your app version, e.g. `\"1.4.2\"`. |\n| `environment` | string | `\"production\"` | `production` / `staging` / `dev` / etc. |\n| `sampleRate` | number | `1` | 0..1 — fraction of events actually sent. |\n| `autoRegister` | boolean | `true` | Install `window.onerror`, `unhandledrejection`, auto-breadcrumbs. |\n| `transport` | `Transport` | `FetchTransport` | For tests / custom transport. |\n| `debug` | boolean | `false` | Log SDK-internal diagnostics to `console.error`. |\n\n## Wire protocol\n\nSee [PROTOCOL_V1.md](./PROTOCOL_V1.md) for the full schema. In short, the SDK\n`POST`s JSON events to `https://<host>/api/ingest/v1/events` with an\n`X-Alby-Dsn: <public_key>` header, handles 429 `Retry-After`, and retries 5xx\nwith backoff. Every event carries a client-generated `event_id` (UUIDv4) so\nretries are idempotent.\n\n## Links\n\n- Website: [alby.sh](https://alby.sh)\n- Report issues: [GitHub Issues](https://github.com/alby-sh/alby-sdk-browser/issues)\n- Other SDKs: [alby-sdk-js](https://github.com/alby-sh/alby-sdk-js) · [alby-sdk-php](https://github.com/alby-sh/alby-sdk-php) · [alby-sdk-python](https://github.com/alby-sh/alby-sdk-python)\n\n## License\n\nMIT © 2026 Alby\n","readmeFilename":"README.md","_rev":"1-9de2826d096b6ed86ecd20456fabfd32"}