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

@responsedata/nextjs

v0.2.3

Published

Next.js integration for Response traffic analytics

Readme

@responsedata/nextjs

The Next.js integration for Response traffic analytics. It can observe incoming server requests and rendered browser page views. Each integration is optional and has its own import path.

The server entry delegates its framework-independent privacy and delivery logic to @responsedata/server, which is installed automatically as a package dependency. Applications still install only @responsedata/nextjs.

npm install @responsedata/nextjs

Server requests

Create a private server token in Response and add it to your environment:

RESPONSE_SERVER_ID=YOUR_PRIVATE_SERVER_ID

Then add a Next.js Proxy beside the app or pages directory. Use proxy.ts at the project root, or src/proxy.ts when that directory is under src:

// proxy.ts (Next.js 16+)
import { createResponseProxy } from "@responsedata/nextjs/server";

export const proxy = createResponseProxy();

export const config = {
  matcher: ["/((?!api(?:/|$)|_next/static|_next/image|favicon.ico).*)"],
};

For Next.js 14 or 15, put middleware.ts in the same location and export it as middleware instead of proxy.

Delivery runs through Next.js waitUntil, so it does not delay or alter the site response. The integration records queryless GET and HEAD paths, the original visitor user agent and referrer origin, and a small allowlist of safe browser headers. It automatically reads Vercel's coarse geolocation headers. It never sends query strings, bodies, cookies, authorization headers, coordinates, postal codes, or IP addresses. Common frontend assets (scripts, styles, images, fonts, and media), API routes, browser fetch/XHR subrequests, JSON-only requests, Next.js internal requests, and prefetches are ignored. Requests that omit browser-only headers remain eligible so direct crawlers can still be observed. Text discovery resources such as robots.txt, sitemaps, and llms.txt remain eligible.

OpenNext Cloudflare reconstructs the NextRequest without its Workers-only cf property. To include the original request's Cloudflare bot-management, network, location, and transport evidence, supply it from the request context:

import { getCloudflareContext } from "@opennextjs/cloudflare";
import { createResponseProxy } from "@responsedata/nextjs/server";

export const middleware = createResponseProxy({
  getCloudflareProperties: () => getCloudflareContext().cf,
});

RESPONSE_SERVER_ID is private and must never use the NEXT_PUBLIC_ prefix. For a local collector, pass an override:

export const proxy = createResponseProxy({
  collectorEndpoint: "http://localhost:3000/api/requests",
});

If the application already has a Proxy, call the Response handler from it:

import { createResponseProxy } from "@responsedata/nextjs/server";
import type { NextFetchEvent, NextRequest } from "next/server";

const responseProxy = createResponseProxy();

export function proxy(request: NextRequest, event: NextFetchEvent) {
  responseProxy(request, event);
  // Keep the application's existing proxy logic here.
}

Browser page views

Add the client component to your root layout:

import { ResponseAnalytics } from "@responsedata/nextjs";

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

The client ID is public, write-only routing information and is separate from the private server token. Configure the site's exact origin and enable collection in Response before installing the component. For a local collector, pass collectorEndpoint="http://localhost:3000/api/events". Remote collectors must use HTTPS.