logo
V^

Next Mahine RSC Inspector

The developer-friendly library to analyze React Server and Client Components in Next.js applications.

logo

Next-mahine-rsc-inspector is an open-source tool that scans your Next.js App Router project to analyze the usage of React Server Components.

It supports both app/ and src/app structures, provides CLI and programmatic APIs, and allows exporting results as JSON for CI pipelines or reports.

How to Install

Next-Mahine-Rsc-Inspector
npm install next-mahine-rsc-inspector

NMRI - CLI

Inspect React Server Components directly from your terminal

CLI command
$ npx next-mahine-rsc-inspector

📦 API

scanProject() scans a full Next.js App Router project and returns global Server and Client Components statistics.
analyzeFile() analyzes a single file and detects whether it is a Client or Server Component.
computeStats() computes aggregated statistics from raw scan results.

📦 API Examples

import { scanProject } from "next-mahine-rsc-inspector";

async function run() {
  const result = await scanProject(process.cwd());

  console.log("Total files:", result?.total);
  console.log("Client components:", result?.client);
  console.log("Server components:", result?.server);
  console.log("Client percentages:", result?.ratioClient %);
  console.log("Server percentages:", result?.ratioServer %);

}

run();
import { analyzeFile } from "next-mahine-rsc-inspector";

async function run() {

 //You put the path of the file here
  const filePath = "src/app/page.tsx";

  const result = await analyzeFile(filePath);


  console.log("File path:", filePath);
  console.log("Is client:", result?.isClient);
}

run();
Combined workflow shows how to scan a project, compute stats, and analyze files together.
Combined workflow shows how to scan a project, compute stats, and analyze files together.
JSON output example of the structured report generated by the library.

✅ App directory: src
{
  "projectName": "next-mahine-rsc-doc",
  "projectRoot": "/media/mahine/2cd32d5c-0a41-43a3-9e8e-d67f38891ca2/next-mahine-rsc-doc",
  "appDir": "/media/mahine/2cd32d5c-0a41-43a3-9e8e-d67f38891ca2/next-mahine-rsc-doc/src",
  "folders": {
    "app": {
      "server": 3,
      "client": 0
    },
    "lib": {
      "server": 1,
      "client": 0
    },
    "components/goTop": {
      "server": 0,
      "client": 2
    },
    "components/ui": {
      "server": 1,
      "client": 1
    },
    "components/web": {
      "server": 1,
      "client": 0
    },
    "components/ui/dark": {
      "server": 0,
      "client": 2
    },
    "components/web/api": {
      "server": 0,
      "client": 1
    },
    "components/web/author": {
      "server": 0,
      "client": 1
    },
    "components/web/cli": {
      "server": 1,
      "client": 1
    },
    "components/web/exemples": {
      "server": 0,
      "client": 2
    },
    "components/web/footer": {
      "server": 0,
      "client": 1
    },
    "components/web/hero": {
      "server": 0,
      "client": 1
    },
    "components/web/install": {
      "server": 1,
      "client": 2
    },
    "components/web/license": {
      "server": 0,
      "client": 1
    },
    "components/web/logoSection": {
      "server": 0,
      "client": 1
    },
    "components/web/motion": {
      "server": 0,
      "client": 3
    },
    "components/web/nav": {
      "server": 0,
      "client": 3
    }
  },
  "total": 30,
  "client": 22,
  "server": 8,
  "ratioServer": 27,
  "ratioClient": 73
}
Mahaman Mahine Kamagaté

Mahaman Mahine Kamagaté

Web & Mobile Developer · JavaScript Library Creator

I’m the creator and maintainer of next-mahine-rsc-inspector. I build developer tools focused on improving architecture, performance, and developer experience in modern Next.js applications,from Côte d’Ivoire 🇨🇮.

Buy me a coffee
Portfolio
Youtube

PLUGIN DETAIL

Version
LicenseMIT
ScopeNext.js only
Compatible withNext.js 14+
📦 Packagist
Total downloads466

Powered by

Next.js
React