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

@dipit_sharma/next-inspect

v0.1.2

Published

TypeScript npm package boilerplate

Readme

next-inspect

This is a package for Next.js apps to intercept the server side network calls. It works for:

  • axios calls by using axios.interceptor implementation
  • fetch calls by overriding the globalThis.fetch method

Host App Script

In the consuming Next.js app, add this script:

{
  "scripts": {
    "intercept": "next-inspect intercept"
  }
}

Next.js Server Integration

Create instrumentation.ts in the root of the Next.js app and register interceptor setup in the Node.js runtime:

import { registerNextInspect } from "next-inspect";

export async function register(): Promise<void> {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    registerNextInspect({
      websocketUrl: "ws://localhost:8757/ws?role=producer",
    });
  }
}

Then start the collector UI + websocket server:

npm run intercept

Environment options:

  • NEXT_INSPECT_ENABLED=false to disable registration.
  • NEXT_INSPECT_COLLECTOR_URL=ws://localhost:8757/ws?role=producer to override websocket URL.

Next.js 13.5.9 (Pages Router)

This package works with Next.js 13.5.9 and Pages Router when used in the Node.js runtime.

Requirements:

  • Enable instrumentation hook in next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    instrumentationHook: true,
  },
};

module.exports = nextConfig;
  • Keep instrumentation.ts at the app root and call registerNextInspect there.
  • Start the collector and Next app as separate processes:
    • npm run intercept
    • npm run dev (or npm run start)

Notes:

  • Captures server-side Axios and fetch calls from the Next.js Node process.
  • Does not capture Edge runtime traffic.
  • Does not capture browser-side network calls.

Using fetch-cross (or other custom fetch clients)

If your app imports a fetch implementation directly (for example fetch-cross), patching only globalThis.fetch may not intercept those calls. In that case, wrap the imported fetch function:

import fetchCross from "fetch-cross";
import { createFetchInterceptor } from "next-inspect";

const fetch = createFetchInterceptor(fetchCross as typeof globalThis.fetch, {
  websocketUrl: "ws://localhost:8757/ws?role=producer",
  maxBufferedNetworkLogs: 200,
});

// Use `fetch` instead of `fetchCross`
const response = await fetch("https://example.com/api");

If you control one central HTTP client module, apply this wrapper there so all imports share the intercepted fetch.

Troubleshooting (Next.js 13.5.9)

  1. instrumentation.ts is not running
  • Check next.config.js has experimental.instrumentationHook = true.
  • Ensure instrumentation.ts is at the app root (same level as next.config.js).
  • Restart Next.js dev server after adding instrumentation.
  1. Dashboard opens but no logs appear
  • Confirm collector is running with npm run intercept.
  • Confirm Next app process is running separately (npm run dev or npm run start).
  • Confirm API calls happen on the server (Node runtime), not only in the browser.
  1. Wrong runtime (Edge)
  • This package only captures in Node runtime.
  • For routes/pages set to Edge runtime, Axios interception will not run.
  1. WebSocket URL mismatch
  • Ensure websocket URL is ws://localhost:8757/ws?role=producer in registerNextInspect or via NEXT_INSPECT_COLLECTOR_URL.
  • If host/port/path was customized, match the same values in both collector and Next app.
  1. Interceptor disabled by env
  • Check NEXT_INSPECT_ENABLED is not set to false.
  1. Multiple Axios versions
  • If app and package resolve different Axios copies, interceptor may patch only one instance.
  • Ensure host app imports Axios consistently and avoids duplicate installations if possible.
  1. Common quick check sequence
  • Start collector: npm run intercept.
  • Open dashboard: http://127.0.0.1:8757.
  • Start Next app: npm run dev.
  • Trigger a server-side Axios request and verify log appears.

Getting Started

  1. Install dependencies:
    npm install
  2. Build the package:
    npm run build