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

@scanfix/browser

v0.1.0

Published

ScanFix browser SDK for error tracking

Readme

@scanfix/browser

Browser SDK for ScanFix error tracking. Captures uncaught errors, unhandled promise rejections, and failed HTTP requests automatically — or use the manual API.

Installation

npm install @scanfix/browser
# or
yarn add @scanfix/browser
# or
pnpm add @scanfix/browser

CDN (no bundler required)

<script src="https://cdn.scanfix.ai/sdk/v1/scanfix.min.js"></script>
<script>
  ScanFix.init({ apiKey: 'sf_your_api_key' });
</script>

Quick Start

import { init } from '@scanfix/browser';

init({
  apiKey: 'sf_your_api_key',       // Required — from your ScanFix project settings
  environment: 'production',        // Optional (default: undefined)
  apiUrl: 'https://api.scanfix.ai', // Optional — override API endpoint
});

Call init() once, as early as possible (e.g. top of main.ts or _app.tsx).

Manual Error Capture

import { captureError, log, flush } from '@scanfix/browser';

// Capture an Error object or a string
captureError(new Error('Payment failed'));
captureError('Something went wrong');

// Log at any level with optional metadata
log('WARN', 'High memory usage', { threshold: 95, current: 98 });
log('INFO', 'User signed in', { userId: 'usr_123' });

// Force-flush the queue immediately (e.g. before page navigation)
await flush();

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | — | Required. Your ScanFix project API key (sf_...) | | environment | string | undefined | Tag logs with environment (production, staging, etc.) | | apiUrl | string | https://api.scanfix.ai | Override the ingestion endpoint | | captureUnhandledErrors | boolean | true | Auto-capture window.onerror and unhandledrejection | | captureNetworkErrors | boolean | true | Auto-capture failed fetch calls (HTTP ≥ 400) | | maxBatchSize | number | 10 | Flush when this many logs are queued | | flushIntervalMs | number | 5000 | Auto-flush interval in milliseconds |

Class API (advanced)

import { ScanFixSDK } from '@scanfix/browser';

const sdk = new ScanFixSDK({
  apiKey: 'sf_your_key',
  environment: 'staging',
  captureNetworkErrors: false, // disable fetch interceptor
});

sdk.captureError(new Error('Oops'));
sdk.log('DEBUG', 'Component mounted');
await sdk.flush();

sdk.destroy(); // clears timers and restores patched globals

Session Tracking

Every SDK instance generates a unique sessionId automatically. All logs from the same page load are grouped under that session ID, enabling the Session Timeline view in ScanFix.

console.log(sdk.currentSessionId); // e.g. "3b7e2f91-..."

React Example

// app/providers.tsx
'use client';
import { init } from '@scanfix/browser';
import { useEffect } from 'react';

export function ScanFixProvider({ children }: { children: React.ReactNode }) {
  useEffect(() => {
    const sdk = init({ apiKey: process.env.NEXT_PUBLIC_SCANFIX_API_KEY! });
    return () => sdk.destroy();
  }, []);

  return <>{children}</>;
}

Batching & Retry

Logs are batched locally and sent in groups of up to maxBatchSize logs or every flushIntervalMs milliseconds, whichever comes first. Failed sends are retried up to 3 times with exponential backoff. On page hide/unload, the queue is flushed synchronously via navigator.sendBeacon.

Bundle Size

| Format | Minified + gzipped | |--------|--------------------| | ESM | ~4 KB | | UMD | ~5 KB | | CJS | ~11 KB |