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

@debugmate/reactjs-test

v1.0.5

Published

DebugMate: An error tracking library for React & Next applications

Readme

DebugMate ReactJS & NextJS

DebugMate is an error tracking and monitoring tool designed for React and Next.js applications. This package captures and sends error reports along with environment, user, and request context information to a remote API.

Singleton Design Pattern

The Debugmate constructor follows the Singleton design pattern, ensuring that only one instance of Debugmate is created during the application lifecycle. This approach helps maintain consistent error reporting across the app.

If you need to reset or reinitialize Debugmate, you can do so manually:

// Reset the singleton instance
Debugmate.instance = null;

// Create a new instance
const newDebugmate = new Debugmate({
  domain: "https://your-new-domain.com",
  token: "new-api-token",
  enabled: true,
});

Installation

1. Install DebugMate

npm i @debugmate/reactjs

Usage

Usage With ReactJS

Initialize DebugMate by wrapping your application with the DebugmateProvider. Provide your API domain, token, and any additional context like user and environment.

import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import { DebugmateProvider } from '@debugmate/reactjs';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <DebugmateProvider
      domain="https://your-domain.com"
      token="your-api-token"
      enabled={true}
      user={{
        id: 1,
        name: "John Doe",
        email: "[email protected]",
      }}
      environment={{
        environment: "production",
        debug: false,
        timezone: "UTC",
        server: "nginx",
        database: "PostgreSQL",
      }}
    >
    <App />
    </DebugmateProvider>
  </React.StrictMode>
);

Usage With NextJS

In Next.js, ensure "use client" is included at the top of the file where DebugmateProvider is used:

"use client"

import { DebugmateProvider } from '@debugmate/reactjs'

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <DebugmateProvider
          domain="https://your-domain.com"
          token="your-api-token"
          enabled={true}
          user={{
            id: 1,
            name: "John Doe",
            email: "[email protected]",
          }}
          environment={{
            environment: "production",
            debug: false,
          }}
        >
          {children}
        </DebugmateProvider>
      </body>
    </html>
  )
}

Set User Context

User details can be passed directly via the DebugmateProvider. For manual updates:

import { useDebugmateContext } from '@debugmate/reactjs';

const debugmate = useDebugmateContext();

debugmate.setUser({
  id: 123,
  name: "Jane Doe",
  email: "[email protected]",
});

Set Environment Context

Add Environment metadata, such as app version or server info:

import { useDebugmateContext } from '@debugmate/reactjs';

const debugmate = useDebugmateContext();

debugmate.setEnvironment({
  environment: "staging",
  debug: true,
  timezone: "PST",
  server: "apache",
});

Set Request Context

Request details such as HTTP method, headers, query strings, and body can be set using the setRequest method. This helps in tracking requests tied to specific errors.

import { useDebugmateContext } from '@debugmate/reactjs';

const debugmate = useDebugmateContext();

debugmate.setRequest({
  request: {
    url: "https://api.example.com/resource",
    method: "POST",
    params: { key: "value" },
  },
  headers: {
    Authorization: "Bearer token",
    "Content-Type": "application/json",
  },
  query_string: { search: "query" },
  body: JSON.stringify({ data: "payload" }),
});

Publish Errors

You can publish errors manually using the publish method. Pass optional user, environment and request contexts for better insights:

import { useDebugmateContext } from '@debugmate/reactjs';

const debugmate = useDebugmateContext();

try {
  throw new Error("Test error");
} catch (error) {
  debugmate.publish(error, user, environment, request);
}