New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@adamtools/apifinder

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adamtools/apifinder

Finds all api endpoints of any nextjs project and adds them into README.md , makes api documentation easier

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

ApiFinder

Automatically discover and document Next.js API endpoints by analyzing your project's file structure. ApiFinder scans your Next.js project for API routes in both Pages Router and App Router patterns, extracts HTTP methods, and generates beautiful documentation.

CLI Usage

# Analyze current directory and update README.md
apifinder

# Analyze specific project path
apifinder --path /path/to/your/nextjs-project

# Output to custom file
apifinder --output API_DOCS.md

# Preview without updating files
apifinder --dry-run

# Get JSON output
apifinder --json

Programmatic Usage

const { ApiFinder } = require('apifinder');

async function analyzeProject() {
  const analyzer = new ApiFinder('./my-nextjs-project');
  const endpoints = await analyzer.analyze();
  
  console.log('Found endpoints:', endpoints);
  
  // Generate markdown table
  const markdownTable = analyzer.generateMarkdownTable();
  console.log(markdownTable);
  
  // Update README.md
  await analyzer.updateReadme();
}

analyzeProject();

Supported Patterns

Pages Router

  • pages/api/users.js → /api/users
  • pages/api/users/[id].js → /api/users/:id
  • pages/api/posts/[...slug].js → /api/posts/*slug
  • src/pages/api/auth/login.js → /api/auth/login

App Router

  • app/api/users/route.js → /api/users
  • app/api/users/[id]/route.js → /api/users/:id
  • app/api/posts/[...slug]/route.js → /api/posts/*slug
  • src/app/api/auth/login/route.js → /api/auth/login

Output Example

ApiFinder generates a table like this in your README:

RouteMethodsFileType
/api/auth/loginPOSTpages/api/auth/login.jsPages Router
/api/usersGET, POSTapp/api/users/route.jsApp Router
/api/users/:idGET, PUT, DELETEapp/api/users/[id]/route.jsApp Router
/api/posts/*slugGETpages/api/posts/[...slug].jsPages Router

Configuration

CLI Options

OptionDescriptionDefault
-p, --path <path>Path to Next.js projectCurrent directory
-o, --output <file>Output README fileREADME.md
--dry-runShow endpoints without updating READMEfalse
--jsonOutput endpoints as JSONfalse

Keywords

endpoints

FAQs

Package last updated on 11 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts