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

api-route-lister

v1.0.7

Published

The Ultimate CLI tool to list, explore and analyze API routes from source code

Readme

🚀 API Route Lister

API Route Lister npm version License: MIT Node.js Version

The Ultimate CLI Tool to List, Explore & Analyze API Routes from Your Source Code

No configuration needed. Just point to your source and discover all your endpoints.

Author: Deepak Ashok Karai


✨ Features

| Feature | Description | |---------|-------------| | 🔍 Auto-Detection | Automatically detects your framework (Express, Fastify, Next.js, Hapi, Koa) | | 📊 Multiple Formats | Table, List, or Tree view for routes | | 💻 Code Preview | View endpoint code directly in CLI with -c flag | | 🎮 Interactive Mode | Browse routes with navigation, search, and filtering | | 🔎 Powerful Filtering | Filter routes by path, method, or pattern | | 📤 Export Options | JSON and Markdown output formats | | 🎨 Beautiful Output | Color-coded HTTP methods with modern UI | | ⚡ Fast Scanning | Efficient recursive file scanning | | 📄 Pagination | Navigate large route lists with ease |


📦 Install

# Install globally (recommended)
npm install -g api-route-lister

# Or use with npx (no install needed)
npx api-route-lister ./src

Requirements

  • Node.js >= 18.0.0
  • npm or yarn

🚀 Quick Start

Basic Usage

# Scan current directory
api-route-lister ./src

# Scan specific path
api-route-lister /path/to/your/project/src

View Code

# Show endpoint code in output
api-route-lister ./src -c

# Filter and show code
api-route-lister ./src -c -F "users"

Interactive Mode

# Browse routes interactively
api-route-lister ./src -i

🎮 Interactive Mode

The interactive mode provides a user-friendly TUI to browse and explore your API routes.

Navigation Actions

[j] Next  [k] Prev  [v] View Code  [g] Go To  [/] Search  [f] Filter  [r] Reset  [q] Quit

Quick Commands (Single-line)

g 50          # Go directly to route #50
/ users       # Search for "users"
f GET         # Filter to only GET routes
j             # Move to next route
k             # Move to previous route
v             # View code of selected route
q             # Quit

Guided Actions (2-step with examples)

When you run an action without arguments, you'll see:

╔══════════════════════════════════════════════════╗
║  [g] Go To Route Number                              ║
╠══════════════════════════════════════════════════╣
║  Example: g 25  or  g 1                          ║
║  Available: 1 - 89                              ║
╚══════════════════════════════════════════════════╝

  Enter route number: _
╔══════════════════════════════════════════════════╗
║  [/] Search Routes                                  ║
╠══════════════════════════════════════════════════╣
║  Example: /users  or  /api/v1/*                    ║
║  Supports partial match and patterns              ║
╚══════════════════════════════════════════════════╝

  Enter search text: _
╔══════════════════════════════════════════════════╗
║  [f] Filter by HTTP Method                       ║
╠══════════════════════════════════════════════════╣
║  Options: GET, POST, PUT, DELETE, PATCH    ║
║  Example: f GET  or  f POST                     ║
╚══════════════════════════════════════════════════╝

  Enter HTTP method: _

🎯 Usage Examples

Output Formats

# Table view (default)
api-route-lister ./src -o table

# List view
api-route-lister ./src -o list

# Tree view (hierarchical)
api-route-lister ./src -o tree

# Tree with code preview
api-route-lister ./src -o tree -c

Filter Routes

# Filter by path pattern
api-route-lister ./src -F "/api/users/*"

# Filter by method
api-route-lister ./src -F "POST"

# Case-insensitive partial match
api-route-lister ./src -F "auth"

Export Options

# JSON output
api-route-lister ./src --json > routes.json

# Markdown table
api-route-lister ./src -m

# Verbose with details
api-route-lister ./src -v

Framework Options

# Auto-detect (default)
api-route-lister ./src

# Explicit framework
api-route-lister ./src -f express
api-route-lister ./src -f fastify
api-route-lister ./src -f nextjs

📋 All Options

| Option | Short | Description | Default | |--------|-------|-------------|---------| | --help | -h | Show help message | - | | --framework | -f | Framework: auto, express, fastify, nextjs, hapi, koa | auto | | --output | -o | Output format: table, list, tree | table | | --json | - | Output as JSON | - | | --markdown | -m | Output as Markdown table | - | | --filter | -F | Filter routes by pattern | - | | --code | -c | Show endpoint code | - | | --interactive | -i | Interactive TUI mode | - | | --verbose | -v | Show detailed information | - | | --no-color | - | Disable colors | - |


🎨 Example Output

Table View

╔══════════════════════════════════════╗
║      API Route Lister v1.0.5          ║
╚══════════════════════════════════════╝

Found 89 routes in 39 files

Framework: EXPRESS

METHOD     PATH                                               FILE                                     LINE
--------------------------------------------------------------------------------------------------------------
GET        /api/users                                         src/routes/users.js                       15
POST       /api/users                                         src/routes/users.js                       32
GET        /api/users/:id                                     src/routes/users.js                       48
PUT        /api/users/:id                                     src/routes/users.js                       65
DELETE     /api/users/:id                                     src/routes/users.js                       82

Tree View

api
├── users
│   ├── GET     /api/users
│   ├── POST    /api/users
│   └── :id
│       ├── GET     /api/users/:id
│       ├── PUT     /api/users/:id
│       └── DELETE  /api/users/:id
├── auth
│   ├── POST   /api/auth/login
│   └── POST   /api/auth/logout
└── products
    ├── GET     /api/products
    └── POST    /api/products

Interactive Mode

╔══════════════════════════════════════╗
║      API Route Lister v1.0.5          ║
╚══════════════════════════════════════╝
API Route Lister | 89 routes | Page 1/3

  1. > POST    /challenge
  2.   POST    /login
  3.   GET     /me
  4.   GET     /users
  5.   POST    /users
  ...

────────────────────────────────────────────────────────────
[j] Next  [k] Prev  [v] View Code  [g] Go To  [/] Search  [f] Filter  [r] Reset  [q] Quit

Code View (in Interactive Mode)

╔══════════════════════════════════════╗
║      API Route Lister v1.0.5          ║
╚══════════════════════════════════════╝

  Method: POST
  Path:   /challenge
  File:   src/routes/auth.routes.js:24

  CODE:

────────────────────────────────────────────────────────────
  24 | router.post("/challenge", (req, res) => {
  25 |   const { username } = req.body;
  26 |   if (!username) return res.status(400).json({ error: "MISSING_USERNAME" });
  27 | 
  28 |   const nonce = createLoginChallenge(username);
  29 |   if (!nonce) return res.status(404).json({ error: "USER_NOT_FOUND" });
  30 | 
  31 |   res.json({ nonce });
  32 | });
────────────────────────────────────────────────────────────
  b - Back to list

🔧 Supported Frameworks

  • Express.js - Most popular Node.js framework
  • Fastify - Fast, low-overhead web framework
  • Next.js - API routes in Next.js applications
  • Hapi - Rich framework for Node.js
  • Koa - Expressive middleware for Node.js

🛠️ Development

# Clone the repository
git clone <repo-url>
cd api-route-lister

# Install dependencies
npm install

# Link for local testing
npm link

# Run locally
node bin/cli.js ./src

🤝 Contributing

Contributions are welcome! Feel free to submit issues and pull requests.


📄 License

MIT License - feel free to use it in your projects!


🙏 Acknowledgments

Built with ❤️ by Deepak Ashok Karai

Using Node.js and these amazing packages:

  • chalk - Terminal string styling
  • ora - Elegant terminal spinner

Made with ❤️ for developers who love clean APIs

If you find this useful, star the repo! ⭐