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

@swapnil454/tracepilot

v0.2.1

Published

Zero-config OpenTelemetry auto-instrumentation for Next.js and Express

Readme

TracePilot React & Node.js SDK

npm version License Types

The official TracePilot SDK for JavaScript environments. It provides zero-config observability, distributed tracing, and automatic crash reporting for both Node.js Backends and React Frontends.

This SDK wraps the @opentelemetry/api ecosystem to provide a seamless, 1-line installation experience for TracePilot users.


Installation

Install the package using your favorite package manager:

npm install @swapnil454/tracepilot
# or
yarn add @swapnil454/tracepilot
# or
pnpm add @swapnil454/tracepilot

Node.js Backend Usage

Initialize the SDK as early as possible in your application lifecycle (ideally at the very top of index.ts or server.ts). It automatically instruments your Express servers, HTTP clients, and tracks unhandled exceptions.

import { tracepilot } from '@swapnil454/tracepilot';

// 1. Initialize TracePilot BEFORE importing Express/Fastify/etc
tracepilot.init({
  token: process.env.TRACEPILOT_TOKEN, // Found in your TracePilot Project Settings
  ingestorUrl: 'https://ingestor.tracepilot.io/v1/traces' // Optional: for self-hosting
});

// 2. Normal App Code
import express from 'express';
const app = express();

app.get('/api/users', (req, res) => {
    // This route is automatically traced!
    res.json({ users: [] });
});

app.listen(8080);

Backend Features

  • Auto-Instrumentation: Zero manual spans required. Automatically traces incoming HTTP requests, outgoing fetch calls, Express routes, and console logs.
  • Crash Safety: Installs uncaughtException and unhandledRejection hooks to guarantee error spans are flushed before Node.js exits.

React Frontend Usage

For frontend web applications, TracePilot provides a specialized Web Provider that captures UI crashes, React Component Stack traces, and browser performance metrics.

Wrap your React application tree with the TracePilotProvider and ErrorBoundary.

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { TracePilotProvider, ErrorBoundary } from '@swapnil454/tracepilot/react';

// You can create a custom fallback UI for when the app crashes
const CrashScreen = () => (
    <div style={{ padding: 20, color: 'red' }}>
        <h1>Oops! The application crashed.</h1>
        <p>Our engineering team has automatically been notified.</p>
    </div>
);

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <TracePilotProvider 
    token="YOUR_PUBLIC_PROJECT_TOKEN" 
    ingestorUrl="https://ingestor.tracepilot.io/v1/traces"
  >
    <ErrorBoundary fallback={<CrashScreen />}>
      <App />
    </ErrorBoundary>
  </TracePilotProvider>
);

Frontend Features

  • React Crash Capture: Our ErrorBoundary hooks into componentDidCatch. If a component throws an error during render, it extracts the react.component_stack, attaches it to an OpenTelemetry span, and flushes it to the dashboard.
  • Web Vitals: Tracks core web performance metrics.
  • Graceful Fallbacks: Prevents white-screen-of-death (WSOD) by displaying your custom fallback UI.

Manual Tracing

If you want to track specific user actions or business logic manually:

import { trace } from '@opentelemetry/api';

const tracer = trace.getTracer('my-frontend-app');

function handleCheckout() {
    tracer.startActiveSpan('checkout_process', (span) => {
        span.setAttribute('cart.value', 150.00);
        
        try {
            // Do checkout logic
            span.addEvent('payment_authorized');
        } catch (e) {
            span.recordException(e);
        } finally {
            span.end();
        }
    });
}

License

MIT License. See LICENSE for more details.