@nilguard/browser-sdk
v0.1.3
Published
Nilguard browser SDK for crash capture, replay snippets, console breadcrumbs, and network metadata.
Maintainers
Readme
Nilguard Browser SDK
Browser crash capture for Nilguard sites.
Install
npm install @nilguard/browser-sdkQuick start
import { init } from "@nilguard/browser-sdk";
const client = init({
siteToken: "ng_site_...",
appId: "console",
environment: "production",
serverUrl: "https://nilguard.example",
release: "git-sha",
});
client.markCrash("setup smoke test", {
route: location.pathname,
});Capture defaults
The browser SDK installs global handlers for window.error and
unhandledrejection, plus manual reporting through reportError() and
markCrash().
Replay, console breadcrumbs, network metadata, and session-end uploads are off by default. Enable them explicitly when the extra context is needed.
init({
siteToken: "ng_site_...",
appId: "console",
environment: "production",
serverUrl: "https://nilguard.example",
replay: { mode: "buffered", bufferMs: 60000 },
console: { mode: "warn-and-error" },
network: { mode: "metadata" },
});Inputs are masked when replay is enabled, console arguments are redacted, and network capture stores metadata only. Request bodies, response bodies, cookies, auth headers, and full headers are not captured.
Hosted bundle
Self-hosted Nilguard deployments also serve browser bundles from the backend:
/sdk/nilguard.js/sdk/nilguard.global.js
Use the npm package for bundled frontend apps and the hosted bundle for direct script-tag installs.
