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

next-build-doctor

v0.2.3

Published

Read a Next.js project and report build-memory and build-performance risks.

Readme

Next build doctor

Next build doctor

Next build doctor reads a Next.js project on disk and reports build-memory and build-performance risks before the build hits them.

next build can run out of memory, stall in static generation, or compile the same code twice — and the framework does not say why. This package names the flag, file, or route family that is likely to cause it.

It is a library and a command. Current release: 0.2.3. Modes: scan (static analysis of source/config, read-only) and inspect (.next artifact inventory: cache weight, prerendered routes, heaviest chunks). profile (supervised next build with memory sampling) is a planned mode.

Each release commit on main is an annotated git tag and an entry in CHANGELOG.md.

  • GitHub: https://github.com/adeshsuryan/next-build-doctor
  • npm: https://www.npmjs.com/package/next-build-doctor
  • JSR: https://jsr.io/@adeshsuryan/next-build-doctor
  • Packagist: https://packagist.org/packages/adeshsuryan/next-build-doctor

Install

Node.js 18 or newer (CI runs 18/20/22/24; Node 18/20 are EOL upstream but kept compatible).

npm / pnpm / yarn (recommended for Next.js)

npm install next-build-doctor
pnpm add next-build-doctor
yarn add next-build-doctor
npx next-build-doctor

JSR

npx jsr add @adeshsuryan/next-build-doctor
# or: deno add jsr:@adeshsuryan/next-build-doctor

Composer (Packagist)

Composer installs the files. Node runs them.

composer require adeshsuryan/next-build-doctor
node vendor/adeshsuryan/next-build-doctor/bin/next-build-doctor.js

Use it from code

// npm (CommonJS)
const { run, render } = require("next-build-doctor");

// npm / JSR (ESM)
// import { run, render } from "next-build-doctor";
// import { run, render } from "@adeshsuryan/next-build-doctor";

const result = run("/path/to/next-app", { mode: "scan" });
process.stdout.write(render(result));

for (const finding of result.findings) {
  if (finding.risk === "high") {
    console.error(finding.id, finding.file, finding.line);
  }
}

run(directory, { mode }) returns { root, mode, fileCount, schemaVersion, project, findings }. render(result) returns the text report. The package has no dependencies.

Use it from the shell

npx next-build-doctor [directory] [--json] [--fail-on-high] [--verbose]

directory defaults to the current working directory. --json prints the same object run() returns. --fail-on-high exits 1 when any finding is high. Exit 2 means the path was refused or could not be read.

Subcommands (scan is the default):

next-build-doctor scan|inspect|profile|docker [directory]

inspect reads .next/ artifacts — no build is run. profile and docker exit 2 until their versions ship.

Example:

Next build doctor
Mode: scan
Files read: 12

PROJECT
  Next: 16.3.8   bundler: turbopack   routers: app
  Routes: 4 (1 dynamic)   static-gen fan-out: unbounded
  Config: cpus=unset  workerThreads=unset  sourcemaps=off  typecheck=on  lint=on
  Heap flag: not found
  Docker: 1 file(s)

FINDINGS

HIGH  static-gen-fanout
app/products/[id]/page.tsx:1
generateStaticParams can create unbounded static-generation fan-out
...

What a high finding means

| Id | What is wrong | | --- | --- | | no-heap-limit-on-large-app | Route count, file count, or heavy dependencies suggest build-memory pressure, and no --max-old-space-size is set anywhere. | | heap-limit-over-container-limit | --max-old-space-size exceeds a Docker/Compose memory limit; the cgroup killer can stop the build before V8 collects. | | static-gen-fanout | generateStaticParams with default dynamicParams can generate an unbounded number of static pages. |

Medium and low findings are in docs/usage.md.

What the scan will not open

  • The filesystem root.
  • Symbolic links.
  • node_modules, .next, .git, dist, coverage, out, and any name that starts with a dot. Two exceptions: .github/workflows/ for CI analysis and .dockerignore for Docker checks. .env files are never read.
  • Files larger than 1 MB.
  • More than 20,000 files. The walk stops there.

The file is read as text. It is not executed. A path that resolves outside the directory you passed is dropped.

A note on profile mode

When profile ships it will run next build in the target project, which executes next.config.js and build plugins. That mode will stay opt-in and will print a warning. Do not run it on code you do not trust. See SECURITY.md.

Develop

git clone https://github.com/adeshsuryan/next-build-doctor.git
cd next-build-doctor
npm test

pnpm test and yarn test run the same node --test script. There is no install step, because the package has no dependencies.

Releases

Versions follow semantic versioning. The git tag, package.json, and jsr.json use the same number. History is in CHANGELOG.md.

Report a vulnerability through GitHub private security reporting, described in SECURITY.md.

License

MIT. Copyright 2026 Adesh Suryan. See LICENSE.