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-component-analyzer

v0.1.4

Published

CLI tool that analyzes Next.js components and suggests whether they should be Server or Client components.

Readme

🕵️‍♂️ Next Component Analyzer

NPM version NPM downloads

Stop guessing if your Next.js components should be Server or Client — let the analyzer do the work.

Ever added "use client" somewhere just because “it might need state” and then wondered a week later, “Wait… does this even need to be a client component?” Yeah… we’ve all been there.

Enter Next Component Analyzer: your CLI sidekick for:

  • Scanning your entire Next.js repo 🔍
  • Detecting React hooks, browser APIs, and JSX event handlers 🪝
  • Suggesting whether a component should be Server or Client
  • Highlighting unnecessary "use client" directives 💥

🚀 Features

  • AST-based analysis — no more false positives from naive string matching
  • Component detection — ignores utils, helpers, configs, and other boring stuff
  • Classification into four meaningful categories:

| Category | What it means | |----------|----------------| | Client Component (correct) | Has client features and "use client" | | Suggested: Client Component | Has client features but missing "use client" | | Suggested: Server Component | No client features, no "use client" | | Could be Server Component (unnecessary client) | "use client" is present, but no client features |

  • Detects: React hooks, Next navigation hooks, browser APIs, JSX events

⚡ Installation

# Run without installing
npx next-component-analyzer

# Or install globally
npm install -g next-component-analyzer
next-component-analyzer

Programmatic Usage

next-component-analyzer can also be used programmatically in scripts, CI pipelines, or other developer tools.

import { analyzeProject } from "next-component-analyzer"

async function run() {
  const results = await analyzeProject()

  console.log(results)
}

run()

Example Output

[
  {
    "filePath": "app/page.tsx",
    "classification": "server",
    "detected": ["fetch"]
  },
  {
    "filePath": "components/button.tsx",
    "classification": "client",
    "detected": ["useState", "useEffect"]
  }
]

Use Cases

The programmatic API allows you to:

  • Integrate analysis into CI pipelines
  • Build custom reports or dashboards
  • Run automated architecture checks
  • Create editor or IDE integrations

Internally, the CLI now uses the same programmatic API, ensuring consistent results across both usage methods.

🧑‍💻 Author

Built with mild obsession and an unreasonable number of AST nodes by cinfinit.

I like building developer tools that solve the tiny annoyances we all pretend don't exist — like staring at a Next.js component wondering “Does this actually need "use client"?”

If this tool saved you from one unnecessary client component, my work here is done.

If it saved you from ten, we can both agree "use client" was getting a little out of hand..

  • GitHub: https://github.com/cinfinit
  • Twitter/X: https://x.com/cinfinitedev

P.S. If the analyzer roasts your component architecture… that's between you and your React hooks.

Changelog

[0.1.2] - 2026-03-13

Programmatic API Support

next-component-analyzer now exposes a programmatic API, allowing the analyzer to be used directly in scripts, CI pipelines, and other tooling instead of only through the CLI.

✨ Added

New function to run the analyzer programmatically.

Results can now be consumed as structured data instead of only CLI output.

Enables integrations with CI tools, custom dashboards, and developer workflows.