Frontend Overview
LaraBug's JavaScript SDK is published as a set of npm packages under the @larabug scope. Each package handles a different piece of the stack, and you install only what you need.
Which package do I need?
| Your stack | Install |
|---|---|
| Plain JavaScript or TypeScript | @larabug/browser |
| React (with or without a router) | @larabug/react |
| Vue 3 | @larabug/vue |
| Inertia.js + Laravel | @larabug/inertia alongside @larabug/vue or @larabug/react |
@larabug/core is a dependency of all of these and gets installed automatically — you don't need to require it directly.
What you get
Regardless of which package you pick:
- Automatic capture of uncaught errors and unhandled promise rejections
- Breadcrumbs — a rolling log of console calls, fetch/XHR requests, navigation events, and user actions, attached to every captured error
- Data filtering — passwords, tokens, cookies, and session data get scrubbed before any event leaves the browser
- Deduplication — identical errors in a tight loop get collapsed so a render bug can't DDoS your ingest endpoint
- Rate limiting + circuit breaker — respects
Retry-Afterheaders and backs off when the ingest endpoint is under load - Framework integration — for React, Vue, and Inertia the SDK plugs into the framework's native error handler chain without replacing it
Do I need a build step?
The packages are published as ESM + CJS with TypeScript declarations. If you're using Vite, webpack, Rollup, or any modern bundler, you're set.
If you don't have a build step, you can load the UMD bundle directly from a CDN:
<script src="https://cdn.jsdelivr.net/npm/@larabug/browser@0.1.0/dist/index.js"></script>
<script>
LaraBug.init({
dsn: 'https://login_key:project_key@www.larabug.com/api/log',
environment: 'production',
});
</script>
jsDelivr and unpkg both auto-mirror npm packages, so any version you publish is immediately available.
Credentials
All JavaScript packages accept the same two credentials as the PHP SDK:
login_key— your personal API keyproject_key— the project API key
You can pass them individually or as a single dsn string:
LaraBug.init({
dsn: 'https://login_key:project_key@www.larabug.com/api/log',
});
Find both on your project page at larabug.com.
Next steps
Pick your framework:
Or jump to the shared topics: