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

@bugban/next

v1.2.0

Published

Bugban SDK for Next.js — App and Pages router, server and client, via instrumentation.

Readme

@bugban/next

Bugban error and performance monitoring for Next.js — server and client.

npm install @bugban/next

Why two entry points

A Next.js app runs in two places at once. A Server Component, route handler or middleware runs in Node; a Client Component runs in the browser. Each side needs different telemetry — slow database queries on the server, Core Web Vitals and DOM snapshots in the browser — so you wire both.

1. Server

Create instrumentation.ts at the project root (next to next.config.js). Next calls register() once per server process, before any request.

// instrumentation.ts
export async function register() {
  const { registerBugban } = await import('@bugban/next');

  await registerBugban({
    apiKey: process.env.BUGBAN_API_KEY,
    host: 'https://bugban.online',
  });
}

release defaults to VERCEL_GIT_COMMIT_SHA or NEXT_PUBLIC_APP_VERSION, and environment to NODE_ENV.

2. Client

// app/bugban.tsx
'use client';
import { BugbanProvider } from '@bugban/next';

export default function Bugban() {
  return (
    <BugbanProvider
      apiKey={process.env.NEXT_PUBLIC_BUGBAN_KEY!}
      host="https://bugban.online"
    />
  );
}
// app/layout.tsx — render it once
import Bugban from './bugban';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <Bugban />
        {children}
      </body>
    </html>
  );
}

3. Error boundary

Next hides the real message of a server-thrown error from the client and gives you a digest instead. Passing it along is the only way to line the client-side report up with the server-side one, which captureNextError does for you.

// app/error.tsx
'use client';
import { useEffect } from 'react';
import { captureNextError } from '@bugban/next';

export default function Error({ error, reset }) {
  useEffect(() => {
    captureNextError(error);
  }, [error]);

  return <button onClick={reset}>Try again</button>;
}

Add app/global-error.tsx the same way to catch failures in the root layout.

Route handlers and server actions

import { withBugbanRoute } from '@bugban/next';

export const POST = withBugbanRoute(async (req) => {
  const body = await req.json();
  return Response.json(await createOrder(body));
}, { name: 'orders.create' });

The error is reported and then rethrown, so your own error handling still runs.

Pages Router

Use registerBugban() from instrumentation.ts exactly as above, call initBugbanClient() once in pages/_app.tsx, and report from pages/_error.tsx with captureNextError.

Slow database queries

Server-side query timing comes from @bugban/node, which is bundled in — hook Prisma, TypeORM, Knex or pg there and slow queries appear in the Performance tab.

Source maps

A production Next build is minified, so stack traces point into hashed bundles. Bugban detects this and says so instead of guessing — set productionBrowserSourceMaps: true in next.config.js to get real file and line numbers.

License

MIT