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

@bugmail-js/core

v0.1.7

Published

Core utilities for the BugMail SDK (framework-agnostic)

Readme

@bugmail-js/core — Core utilities for BugMail SDKs

This package contains framework-agnostic building blocks used by the BugMail JavaScript SDKs (browser, Node, and server integrations).

Use this package if you are building a custom integration or need low-level control. It exports small, well-scoped classes for capturing errors, tracking breadcrumbs, and sending reports.

Highlights

  • BugMailCoreClient — lightweight client that prepares and sends error payloads to the BugMail backend.
  • BreadcrumbTracker — record user events leading up to an error.
  • CoreNetworkManager, CoreErrorProcessor — helpers for networking and normalization.

Installation

Typically you do not need to install this directly; other SDK packages depend on it. If you need it directly:

npm install @bugmail-js/core

Quick example (capture an exception)

import { BugMailCoreClient } from '@bugmail-js/core';

const client = new BugMailCoreClient({
  baseUrl: process.env.BUGMAIL_ENDPOINT || '<your-bugmail-endpoint>',
  apiPath: '/api/sdk/v1/errors',
  onError: (info) => console.warn('Reporting failed', info),
});

await client.captureException(new Error('Test error'), {
  headers: { 'x-bugmail-api-key': 'YOUR_PROJECT_API_KEY' },
  payload: {
    error: { name: 'Error', message: 'Test error', stack: '...' },
    context: { url: '/test', environment: 'development' }
  },
});

API reference (important parts)

  • new BugMailCoreClient(config)

    • config.baseUrl — backend base URL (default: env BUGMAIL_API_BASE_URL or <your-bugmail-endpoint>)
    • config.apiPath — ingestion path (default: /api/sdk/v1/errors)
    • config.onError — optional callback invoked when report fails
  • captureException(error, context)

    • error — Error object or any serializable value
    • context — optional object: { headers, payload, user, breadcrumbs }
      • Include headers: { 'x-bugmail-api-key': '<YOUR_PROJECT_API_KEY>' }
  • BreadcrumbTracker

    • new BreadcrumbTracker({ maxBreadcrumbs })
    • record(breadcrumb) — add a breadcrumb object
    • recordCustom(message, category, data, level)
    • recordRequest(requestData) — convenience for HTTP breadcrumbs
    • getBreadcrumbs(), clear()

Advanced

  • CoreNetworkManager and CoreErrorProcessor are exported for advanced integration points (custom retries, queueing, or server-side normalization).

Integration notes

  • The core package is intentionally minimal and has no browser-only dependencies. Browser and Node SDKs re-export and extend it with environment-specific behavior (automatic capture, global handlers, middleware, etc.).

Backend integration & headers

  • Ingestion endpoint: POST {baseUrl}/api/sdk/v1/errors
  • Auth header: x-bugmail-api-key: <YOUR_PROJECT_API_KEY>
  • Note: HTTP header names are case-insensitive; use the canonical lowercase form above for consistency.
  • Typical payload shape:
{
  "error": { "name": "TypeError", "message": "...", "stack": "..." },
  "context": { "breadcrumbs": [...], "request": { ... } },
  "timestamp": "2025-09-06T15:40:00.000Z",
  "environment": "production"
}

The backend validates the API key, groups the error, stores breadcrumbs, enforces rate/plan limits, may run AI analysis, and returns 201 with { status: "success", error_id: "..." }.

Contributing

Please follow the repository contributing guidelines. Tests and simple usage examples are appreciated.

Shared core logic for BugMail SDKs

This package will contain shared logic for Node.js and Django SDKs.