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

nxpage

v1.0.24

Published

Serve structured JSON instead of full HTML built specifically for AI agents, crawlers, and automation clients.

Downloads

1,716

Readme

nxpage

Serve structured JSON for AI agents/crawlers while keeping normal Next.js behavior for regular users.

Why nxpage

nxpage is designed for traffic from AI agents and crawlers (for example ChatGPT/OpenAI agents, Claude/Anthropic, Perplexity, and similar systems).

Instead of sending heavy browser-focused HTML and hydration payloads, NxPage can return compact JSON data for those requests.

Benefits:

  • faster response for bot/agent traffic,
  • significantly lower bandwidth and transfer costs,
  • less server load for non-human traffic,
  • consistent machine-readable page output.

For bot-targeted responses, transfer size can drop by up to ~99% depending on the page content.

How it works (two outputs)

NxPage uses the same Next.js build as input, then creates two different response outputs:

  1. Human output (HTML build)
    Standard Next.js pages generated by next build and served normally for human/browser traffic.
  2. Bot output (JSON build)
    NxPage reads generated HTML files and creates per-route JSON pages for AI agents.

So in practice you get:

  • normal Next HTML for users,
  • lightweight JSON pages for AI agents (ChatGPT/OpenAI, Claude, Perplexity, and others).

Build flow

# 1) Normal Next.js build (HTML output)
next build

# 2) NxPage bot build (JSON output)
nxpage build

After this, your app has both artifacts:

  • Next HTML output in .next/*
  • NxPage JSON output in .next/nxpage-pages/*

Install

npm i nxpage

Exports

  • createNxPageServer(options?)
  • generateNxPageManifest(options?)

createNxPageServer

Create a custom server that:

  • detects bot/agent traffic,
  • serves prebuilt NxPage JSON manifest for matching routes,
  • falls back to normal Next request handling for other cases.

Options

  • port?: number (default 3000)
  • manifestPath?: string (default .next/nxpage-pages/server/app)
  • isBot?: (req) => boolean
  • includeRoutePatterns?: (string | RegExp)[]
  • blockRoutePatterns?: (string | RegExp)[]

Route pattern behavior

  • If includeRoutePatterns is provided, only matching routes are eligible.
  • blockRoutePatterns always excludes matched routes.
  • Final rule: route must pass include filter (if any) and not match block filter.

Example

import { createNxPageServer } from "nxpage";

createNxPageServer({
  port: 3000,
  includeRoutePatterns: ["/docs/**", "/blog/**"],
  blockRoutePatterns: ["/docs/internal/**"],
});

End-to-end usage

1) Build Next.js app

next build

2) Generate NxPage route JSON

import { generateNxPageManifest } from "nxpage";

await generateNxPageManifest({
  distDir: ".next",
  includeRoutePatterns: ["/docs/**", "/blog/**"],
  blockRoutePatterns: ["/docs/internal/**"],
});

3) Start NxPage server

import { createNxPageServer } from "nxpage";

createNxPageServer({
  port: Number(process.env.PORT ?? 3000),
  includeRoutePatterns: ["/docs/**", "/blog/**"],
  blockRoutePatterns: ["/docs/internal/**"],
});

4) Result

  • AI agents receive NxPage JSON for allowed routes.
  • Blocked or non-included routes fall back to normal Next.js handling.
  • Human users continue to receive standard HTML pages.

generateNxPageManifest

Scans Next build output HTML and generates JSON manifest files consumed by the server.

Options

  • distDir?: string (default .next)
  • manifestPath?: string
  • includeRoutePatterns?: (string | RegExp)[]
  • blockRoutePatterns?: (string | RegExp)[]

Example

import { generateNxPageManifest } from "nxpage";

await generateNxPageManifest({
  distDir: ".next",
  includeRoutePatterns: ["/docs/**"],
  blockRoutePatterns: ["/docs/internal/**"],
});

CLI

The package includes a CLI:

nxpage build

This runs manifest generation with default options.

Local Development (Monorepo)

cd newupdate/packages/nxpage
npm install
npm run build