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

next-route-mapper

v1.1.0

Published

Zero-dependency CLI that scans Next.js App Router projects and sub-routes to list all API endpoints and HTTP methods.

Readme

next-route-mapper

CI npm version license: MIT

A zero-dependency CLI for scanning Next.js App Router API endpoints and their exported HTTP methods — GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.

Why?

As Next.js App Router projects scale, API handlers get nested deep within route.ts files throughout the folder structure. Developers easily lose track of how many API routes exist, what their exact URL endpoints are, and which HTTP verbs each route handles.

next-route-mapper solves this confusion in seconds. Pass a project root or a specific sub-path (like app/api/auth), and get an instant, clear map ready for PRs, auditing, or living documentation.

📡 Next.js API Routes
┌──────────────────┬────────────────────┬────────────────────────────────────────┐
│ ROUTE            │ METHODS            │ FILE                                   │
├──────────────────┼────────────────────┼────────────────────────────────────────┤
│ /api/auth/login  │ POST               │ app/api/auth/login/route.ts            │
│ /api/products    │ GET, POST          │ app/api/products/route.ts              │
│ /api/products/[id]│ GET, PATCH, DELETE│ app/api/products/[id]/route.ts        │
└──────────────────┴────────────────────┴────────────────────────────────────────┘

Total endpoints: 3

Methods are color-coded in terminals (GET green, POST blue, PUT yellow, PATCH magenta, DELETE red, HEAD/OPTIONS cyan/gray).


Contents


Installation

Install as a development dependency:

npm install -D next-route-mapper

Quick Start

Run using npx nrmap (or npx next-route-mapper):

# Scan current working directory (.) by default
npx nrmap

# Scan a specific Next.js project directory
npx nrmap ./my-next-app

# Scan a specific sub-route path (e.g., auth endpoints only)
npx nrmap app/api/auth

Options & Flags

npx nrmap [path] [options]

| Flag | Description | Default | | ----------- | ---------------------------------------------------- | ------------------------------- | | [path] | Path to project root or sub-folder | Current working directory (.) | | -f <type> | Output format: table, json, or markdown (md) | table | | -o <file> | Save output directly to a file path | stdout | | -h | Display usage help | — |

Smart Format Inference: When using -o <file> without specifying -f, format is inferred automatically from the file extension (.md -> Markdown, .json -> JSON).


Examples

# Default terminal table scan
npx nrmap

# Scan specific sub-directory
npx nrmap app/api/auth

# Output as a Markdown table
npx nrmap app/api -f md

# Write Markdown table directly to API.md
npx nrmap -o API.md

# Save JSON data for custom tooling or scripts
npx nrmap -f json -o routes.json

Features

  • Flexible Path Scanning: Scans full projects or sub-folders (e.g. app/api/auth) while computing canonical URL routes relative to app or src/app.
  • Comprehensive Handler Matching: Detects async/sync function exports, const/let/var handlers, and re-exports (export { GET, POST } or export { handler as GET }).
  • Route Group & Slot Cleanup: Strips Next.js route groups ((admin)), parallel route slots (@modal), and intercepting route markers while preserving dynamic ([id]) and catch-all ([...slug]) parameters.
  • Zero Dependencies: Pure Node.js (fs/path only) — runs fast on macOS, Linux, and Windows.

License

MIT © nero-tx