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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nextjs-web-vitals

v1.0.3

Published

Core Web Vitals validator for Next.js projects

Readme

📦 nextjs-web-vitals

A Core Web Vitals (CWV) validator for Next.js projects, compatible with both App Router and Pages Router. Automatically scans all pages or single page and outputs a JSON report with detailed performance metrics.


Features

✅ Automatically detects all pages in a Next.js project.

✅ Works with both Next.js App Router and Pages Router.

✅ Outputs a detailed JSON report of Core Web Vitals

  • Performance scorecore
  • Accessibility score
  • Best Practices score
  • SEO score
  • LCP
  • FID
  • CLS
  • TBT
  • FCP

✅ Integrates seamlessly with npm run build.

✅ Supports local development testing with configurable throttling.

✅ CLI-based tool: easy to run on any environment.

✅ Optional mobile and desktop emulation for accurate results.

Installation:

npm install nextjs-web-vitals

Usage

npx cwv-validator

✅ Advance Usage of Modes

Full site scan

BASE_URL=https://www.example.com npx cwv-validator

Single page scan

PAGE_URL=https://www.example.com/about npx cwv-validator

Desktop mode scan

BASE_URL=https://www.example.com MODE=desktop npx cwv-validator

Example output:

🔍 Found 4 pages: [ '/about', '/contact', '/index', '/login' ]
🚀 Analyzing http://localhost:3000/about...
✅ LCP: 1.8s, FID: 12ms, CLS: 0.02
...
📄 Report saved to cwv-report.json

Report Output:

cwv-report.json


Integrate with npm run build

{
  "scripts": {
    "build": "next build",
    "postbuild": "npx cwv-validator"
  }
}

This will automatically generate a CWV report after each build.


JSON Output

[
  {
    "url": "https://www.example.com/about",
    "performance": 79,
    "accessibility": 92,
    "bestPractices": 83,
    "seo": 96,
    "lcp": "3.7 s",
    "cls": "0.021",
    "tbt": "390 ms",
    "fcp": "1.1 s",
    "speedIndex": "3.3 s"
  }
]

Contribution

Contributions are welcome! Feel free to open issues or pull requests.


Made with ❤️ for Next.js developers.


👤 Author

Neetesh Keshari [Engineering Manager]