

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

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
npm install next-mahine-rsc-inspectorInspect React Server Components directly from your terminal
$ npx next-mahine-rsc-inspector📦 API
📦 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();
✅ 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
}Powered by