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

apiscan

v1.0.5

Published

CLI tool for analyzing API usage and field usage in TypeScript codebases

Downloads

21

Readme

APIScan

🔍 A powerful CLI tool for analyzing API usage and field usage in TypeScript/JavaScript codebases.

APIScan helps you understand which APIs are being used in your codebase and whether specific fields from API responses are actually being utilized. Perfect for API cleanup, refactoring, and understanding code dependencies.

Features

  • 🎯 API Usage Analysis: Check if specific API endpoints are being used
  • 📊 Field Usage Analysis: Analyze which fields from API responses are actually used
  • 🔍 Pattern Matching: Support for path parameters like /api/v1/orders/{id}
  • 🎨 UI Rendering Detection: Identify fields that are rendered in JSX/UI components
  • 📝 Multiple Type Definitions: Show all locations where a field is defined
  • 🌈 Beautiful Output: Colorful and well-formatted analysis results
  • 💬 Interactive Mode: User-friendly prompts for easy usage

Installation

Global Installation

npm install -g apiscan

Using without installation

npx apiscan

Usage

Interactive Mode (Recommended)

apiscan

This will start an interactive session where you'll be prompted to enter:

  • API pattern to search for
  • Field names to analyze (optional)
  • Project path
  • Verbose output preference

Direct Usage

# Basic API usage check
apiscan "/api/v1/orders"

# API with field analysis
apiscan "/api/v1/orders/{id}" "lastExecutedAt,orderNo"

# Specify project path
apiscan "/api/v1/orders" "fieldName" --project /path/to/your/project

# Enable verbose output
apiscan "/api/v1/orders" "fieldName" --verbose

Examples

Check API Usage

apiscan "/api/v1/trading/orders/histories/{type}"

Analyze Specific Fields

apiscan "/api/v1/orders/{id}" "lastExecutedAt,status,amount"

Output Example

🔍 Analyzing API usage...

┌─────────────────┬──────────────────────────────┐
│ API Pattern     │ /api/v1/orders/{id}          │
│ Project         │ /Users/currybob/src/my-project    │
│ Analyzed Files  │ 127 files                    │
└─────────────────┴──────────────────────────────┘

📊 API Usage Analysis Result

✅ API Usage: Found in 5 locations

📍 Usage Locations:
   • services/OrderService.ts:25
     const response = await fetch('/api/v1/orders/123')

📊 Field Analysis Result: lastExecutedAt

✅ Type Definitions: Found in 3 locations
   1. interface Order in types/Order.ts:10
      lastExecutedAt: string | null;
   2. interface OrderItem in types/OrderItem.ts:18
      lastExecutedAt?: string;
   3. type OrderHistory in types/History.ts:23
      lastExecutedAt: string;

✅ Field Usage: Used in 8 locations

   Field Access:
   • OrderService.ts:35 - order.lastExecutedAt
   • orderHelpers.ts:42 - { lastExecutedAt } = order

   UI Rendering:
   • OrderList.tsx:156 - <span>{order.lastExecutedAt}</span>

✅ UI Rendering: Rendered in 3 locations

Analysis completed! 🎉 (1.2s)

Use Cases

  • API Cleanup: Find unused API endpoints before deprecation
  • Field Analysis: Identify unused fields in API responses
  • Refactoring: Understand field dependencies before making changes
  • Documentation: Get insights into how APIs are actually used
  • Performance: Optimize API responses by removing unused fields

Supported File Types

  • TypeScript (.ts, .tsx)
  • JavaScript (.js, .jsx)

Pattern Matching

APIScan supports flexible API pattern matching:

  • Exact paths: /api/v1/orders
  • Path parameters: /api/v1/orders/{id}
  • Multiple parameters: /api/v1/users/{userId}/orders/{orderId}

Requirements

  • Node.js 14.0.0 or higher
  • TypeScript/JavaScript project

Development

# Clone the repository
git clone https://github.com/currycurrybob/apiscan.git
cd apiscan

# Install dependencies
pnpm install

# Build the project
pnpm run build

# Run tests
pnpm test

# Development mode
pnpm run dev

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © currybob

Changelog

1.0.0

  • Initial release
  • API usage analysis
  • Field usage analysis
  • Interactive CLI interface
  • Support for TypeScript AST analysis