
next-coverage: which Next.js APIs your app uses
npx next-coverageSee which Next.js APIs your project uses, which ones would apply to it, and why the rest were left alone.
Sections
Overview
It reads an App Router project and sorts every framework API it knows into four buckets. There is no score and no percentage: 29 of 151 is not a grade, and the four counts are the answer.
- 29Usedthe API is in the project
- 1Would applythe conditions for it are in the code and it is not there
- 8Not applicableruled out, with the reason printed
- 113Not evaluatedno judgement, broken down by why
Would apply is an opportunity, not a defect. This tool never says your code is wrong.
It reads source files. It never builds your app, never runs it and never sends anything anywhere. If a production build happens to be sitting there, it reads that too and contrasts the two.
Example run
next-coverage · Next.js 16.3.0-preview.10 · ~/next16-commerce1.2s · 151 entries examined
Run against aurorascharff/next16-commerce at 13d17c0f, on Next.js 16.3.0-preview.10. Everything below is copied from that run.
- 29Usedthe API is in the project
- 1Would applythe conditions for it are in the code and it is not there
- 8Not applicableruled out, with the reason printed
- 113Not evaluatedno judgement, broken down by why
29 of 30 evaluated APIs are in use.
The 3 findings
declared here, and no invalidation names them anywhere in the project
a tag lets revalidateTag drop exactly these scopes, so a change reaches the page without waiting out the profile
products- features/product/product-queries.ts
these cache scopes inherit the default profile because they never set one
a profile sets how long the scope is fresh and how long it may be served stale, instead of the framework’s default
- features/category/components/Categories.tsx
- features/category/components/CategoryFilters.tsx
- features/category/components/FeaturedCategories.tsx
- and 8 more
the project serves 7 pages and declares no sitemap
a sitemap file generates the XML from the routes, so crawlers find every page rather than the ones something links to
- app
Checked by hand
features/product/product-queries.ts:47 — getProducts declares 'use cache', cacheLife('minutes') and cacheTag('products') features/product/components/{Product,ProductDetails}.tsx — cacheTag('product-' + productId) features/product/product-actions.ts:54 — setFeaturedProduct changes the featured product and calls revalidateTag('featured-product', 'max')
Nothing in the project ever names products or product-<id>.
Set a featured product and the hero updates at once, while the listing can serve the previous one until the minutes profile expires.
With cacheLife("minutes") that may well be deliberate. The tool reports it as an observation and so does this page.
Client weight
- /all20 modules
- /16 modules
- /product/[id]15 modules
- /cart12 modules
- /user12 modules
And 2 more routes, all lighter than these.
nothing contrasted: no production build found at .next
The four buckets
- 29Usedthe API is in the project
- 1Would applythe conditions for it are in the code and it is not there
- 8Not applicableruled out, with the reason printed
- 113Not evaluatedno judgement, broken down by why
Only one bucket asks anything of you. Would apply means the conditions the API needs are already in the code and the API is not: worth a look, never a bug. The palette keeps red for a genuine contradiction, and this run has none.
What it refuses to judge
The interesting number is the largest one: 113 entries it did not evaluate, broken down rather than swallowed.
- 32 abstained
- 5 suggested on another entry
- 72 evaluated and unmatched
Abstained means the evidence was not good enough to answer either way. A tool that never abstains is guessing.
Presets
The default run prints what it can argue for: 3 findings here. Run it with no flags.
--strict lowers the bar and adds the opt-in suggestions: 14 findings on the same project, same second.
npx next-coverage --strict --findings
65 opt-in suggestions withheld by default, and the report says so on every run rather than hiding them. --findings prints the list; --json gives the whole report.
13 documented constraints checked, none contradicted.
Both presets read exactly the same files. --strict changes what gets reported, never what gets analysed.
Scope and limits
- It reads files. It does not build, run, install or send anything.
- Node.js 20.19+, Next.js 16.2+, App Router. Pages Router projects are out of scope.
- Build contrast and client weight need a production build in
.next. Without one it says so instead of guessing. - It is version 0.1.0. In
0.xthe CLI output and the JSON shape can change between minors, so the run on this page carries its date. - It is not a linter. It says nothing about whether your code is correct, only about which of the framework you are using.
Links
- github.com/xabierlameiro/next-coverageSource code, README and issues
- npmjs.com/package/next-coverageThe package on npm
- npmx.dev/package/next-coverageInstall size, dependency tree and downloads
- next-leakThe other tool: does your app leak memory?
- A bucket you disagree with? Open an issue