npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koda-sdk-browser

v0.1.1

Published

Koda browser SDK: programmatic KodaClient.report() and an opt-in Shadow-DOM drop-in widget for user-triggered bug reports.

Downloads

37

Readme

koda-sdk-browser

Browser SDK for Koda — a self-hosted, user-triggered bug report platform. Ships a programmatic API plus an opt-in Shadow-DOM drop-in widget. Lazy-loads the screenshot library and widget chunk, so a page that initializes but never reports pays only the core bundle.

Install

bun add koda-sdk-browser
# or
npm install koda-sdk-browser

If you don't have a build system, use the embed snippet from the Koda dashboard (Settings → Keys → "Embed snippet") instead — no install required.

Initialize

import { KodaClient } from "koda-sdk-browser";

KodaClient.init({
  ingestUrl: "https://koda.your-company.com/api/reports",
  projectKey: "koda_pk_...",
  environment: "production",
  release: "[email protected]",
  service: "checkout-frontend", // optional; helps in multi-service projects
  widget: { enabled: true }     // optional; mounts the floating button + modal
});

init is a no-op on the server (Node, Deno, Bun server runtimes), so it's safe to call from shared modules in Next.js / Nuxt / Remix / SvelteKit.

Programmatic report

import { KodaClient } from "koda-sdk-browser";

const outcome = await KodaClient.report({
  description: "Checkout button does nothing on Safari 17",
  reporter: { name: "Avery", email: "[email protected]" },
  includeScreenshot: true,
  tags: { surface: "checkout" },
  error: caughtError, // optional Error or string
  correlationId: requestId // optional; ties this report to a backend request
});

if (!outcome.ok) {
  console.warn("report failed:", outcome.error);
}
if (outcome.screenshot && !outcome.screenshot.ok) {
  console.warn("screenshot failed:", outcome.screenshot.reason, outcome.screenshot.message);
}

What gets captured

Even before you call report(), the SDK silently ringbuffers (default 100 each, configurable):

  • console.log / warn / error calls
  • fetch and XMLHttpRequest activity (method, URL, status, duration, redacted headers)
  • Click and navigation breadcrumbs

When report() runs, all of the above plus page context (URL, viewport, locale, timezone, user-agent), the parsed stack trace, the reporter's identity, and an optional screenshot are bundled into a single POST /api/reports.

Customize redaction:

KodaClient.init({
  // ...
  redact: (value, hint) => {
    if (hint.kind === "header" && typeof value === "string") {
      return value.replace(/Bearer .+/i, "Bearer [redacted]");
    }
    return value;
  }
});

Drop-in widget

KodaClient.init({
  // ...
  widget: {
    enabled: true,
    position: "bottom-right",
    buttonLabel: "Report a bug",
    accentColor: "#7257ff",
    defaultIncludeScreenshot: true
  }
});

The widget renders inside Shadow DOM so host CSS won't leak into it (and vice versa). The widget chunk is fetched on first init only when widget.enabled === true.

Bundle size

| Entry | Size (gzipped) | When | |---|---|---| | Core client | ~4KB | Always | | widget.js | ~5.5KB | Only when widget.enabled === true | | html-to-image vendor chunk | ~5.7KB | Only on the first report({ includeScreenshot: true }) |

License

MIT