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

@citadel-logs/error-tracking

v0.1.0

Published

Citadel error tracking SDK for JavaScript and TypeScript

Downloads

85

Readme

@citadel/error-tracking

Zero-dependency error tracking SDK for JavaScript and TypeScript with React bindings.

Installation

npm install @citadel/error-tracking

Quick Start

Basic Setup

import { init } from '@citadel/error-tracking';

init({
  endpoint: 'https://citadel.example.com',
  apiKey: 'ck_...',
  environment: 'production',
  release: 'v1.2.3',
});

React Error Boundary

import { CitadelErrorBoundary } from '@citadel/error-tracking/react';

function App() {
  return (
    <CitadelErrorBoundary fallback={<ErrorPage />}>
      <YourApp />
    </CitadelErrorBoundary>
  );
}

React Hook

import { useCitadelError } from '@citadel/error-tracking/react';

function MyComponent() {
  const { captureError, captureMessage } = useCitadelError();

  const handleClick = async () => {
    try {
      await riskyOperation();
    } catch (error) {
      captureError(error);
    }
  };

  return <button onClick={handleClick}>Do Something</button>;
}

HOC Wrapper

import { withCitadelErrorBoundary } from '@citadel/error-tracking/react';

const MyComponent = () => <div>Content</div>;

export default withCitadelErrorBoundary(MyComponent, {
  fallback: <div>Error occurred</div>,
});

Features

  • Zero Dependencies: Vanilla JavaScript, <5KB minified+gzipped
  • Tree-Shakeable: React bindings only loaded when imported
  • TypeScript Support: Full type definitions included
  • Automatic Batching: Errors batched and sent every 5s
  • Rate Limiting: Client-side limit of 100 errors/minute
  • Defensive: Graceful degradation if Citadel unreachable
  • React 18+ Compatible: Works with concurrent features

API Reference

Core SDK

init(config: CitadelConfig)

Initialize the SDK.

init({
  endpoint: 'https://citadel.example.com',
  apiKey: 'ck_...',
  environment: 'production', // optional
  release: 'v1.2.3', // optional
  captureConsoleErrors: true, // optional
  beforeSend: (error) => error, // optional
  sampleRate: 1.0, // optional (0-1)
  debug: false, // optional
});

captureError(error: Error, context?: ErrorContext)

Capture an error.

try {
  riskyOperation();
} catch (error) {
  captureError(error, {
    extra: { userId: '123' },
  });
}

captureMessage(message: string, context?: ErrorContext)

Capture a message.

captureMessage('Something unexpected happened', {
  extra: { details: 'Additional context' },
});

setContext(context: ErrorContext)

Set global context for all errors.

setContext({
  user: { id: '123', email: '[email protected]' },
  extra: { appVersion: '1.0.0' },
});

React Bindings

<CitadelErrorBoundary>

Error boundary component.

<CitadelErrorBoundary
  fallback={<ErrorPage />} // or function
  onError={(error, componentStack) => {}}
  context={{ extra: { page: 'dashboard' } }}
>
  <App />
</CitadelErrorBoundary>

withCitadelErrorBoundary(Component, options?)

HOC to wrap component with error boundary.

const WrappedComponent = withCitadelErrorBoundary(MyComponent, {
  fallback: <div>Error</div>,
  onError: (error, stack) => console.log(error),
  context: { extra: { component: 'MyComponent' } },
});

useCitadelError()

Hook for manual error reporting.

const { captureError, captureMessage, setContext, isInitialized } =
  useCitadelError();

Defensive Features

  • Infinite Loop Protection: Error boundary never throws
  • Stack Truncation: Stack traces limited to 50KB
  • Component Stack Truncation: Limited to 50 frames
  • Rate Limiting: Max 100 errors/minute client-side
  • Graceful Degradation: App continues if Citadel unreachable

Bundle Size

  • Core SDK: ~3KB minified+gzipped
  • React bindings: ~2KB minified+gzipped (when imported)
  • Total (with React): ~5KB minified+gzipped

License

MIT