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

@traceora/next

v0.4.8

Published

Next.js App Router instrumentation for Traceora

Readme

   

Adds client diagnostics and trace correlation for Route Handlers. Server Action traces are collected on the server and require an onTrace callback for access; they are not automatically joined to the browser timeline.


📥 Installation

npm install @traceora/next

✨ Exports

| Export | Type | Description | |---|---|---| | <TraceoraNextProvider> | Client Component | Frontend provider — initializes tracing, instruments fetch/XHR, adds DevTools overlay. | | withTraceora() | HOF | Wraps Route Handlers to establish a backend trace context and inject events into the response. | | traceAction() | HOF | Captures a Server Action and nested backend events; provide onTrace to receive its server-local events. | | emitTraceEvent() | Function | Manually emit a backend event within a traced request. | | traceoraPrismaExtension() | Prisma Extension | Auto-traces every Prisma query within a request. | | traceoraMongoosePlugin | Mongoose Plugin | Auto-traces every Mongoose operation within a request. |


🔧 Usage

1. Client Provider

Wrap your root layout to enable frontend tracing:

// app/layout.tsx
import { TraceoraNextProvider } from '@traceora/next/client';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <TraceoraNextProvider>
          {children}
        </TraceoraNextProvider>
      </body>
    </html>
  );
}

2. Trace Route Handlers

Wrap your API routes with withTraceora to bridge backend events to the frontend:

// app/api/users/route.ts
import { NextResponse } from 'next/server';
import { withTraceora, emitTraceEvent } from '@traceora/next';

export const GET = withTraceora(async (req: Request) => {
  emitTraceEvent({
    type: 'STATE_CHANGE',
    source: 'Next.js API',
    metadata: { info: 'Fetching users...' },
  });

  return NextResponse.json({ users: [] });
});

3. Trace Server Actions

Wrap Server Actions with traceAction to capture execution time and receive the resulting server-local events:

'use server';
import { traceAction } from '@traceora/next';

export const createUser = traceAction('createUserAction', async (data: unknown) => {
  // Your action logic...
  return { success: true };
}, (events) => {
  // Forward to your own development logger or storage if needed.
  console.debug(events);
});

traceAction does not automatically return its events to the browser or correlate them with a client trace.

4. Auto-Track Database Queries

Plug in your ORM — every query is traced automatically:

import { PrismaClient } from '@prisma/client';
import { traceoraPrismaExtension } from '@traceora/next';

const prisma = new PrismaClient().$extends(traceoraPrismaExtension());
import mongoose from 'mongoose';
import { traceoraMongoosePlugin } from '@traceora/next';

mongoose.plugin(traceoraMongoosePlugin);

🔗 Related Packages

| Package | Role | |---|---| | @traceora/core | The underlying event engine | | @traceora/react | React bindings (used internally by the Next.js provider) | | @traceora/node | Shared backend primitives (AsyncLocalStorage, DB plugins) |