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

express-route-visualizer

v0.4.0

Published

Visualize Express.js routes in a beautiful, organized format

Downloads

17

Readme

Express Route Visualizer

npm version Build Status License: MIT npm downloads TypeScript

A lightweight utility to extract and display Express.js application routes in clean format.

Features

  • 🧭 Clear route overview: Displays all your API routes in a structured format
  • 🔍 Domain filtering: Filter routes by specific domains for focused views
  • 🔒 Authentication indicators: Clearly shows which routes are protected
  • 📐 Flexible filtering: Filter routes by protection status and custom criteria
  • 📊 Easy integration: Works with any Express.js application

Installation

npm install express-route-visualizer

Usage

Basic Usage

Express Route Visualizer Output

const express = require("express");
const { displayRoutes } = require("express-route-visualizer");

const app = express();

// Define your routes
app.get("/api/users", (req, res) => res.send("Get users"));
app.post("/api/users", (req, res) => res.send("Create user"));
app.get("/api/products", (req, res) => res.send("Get products"));

// Display all routes when your app is ready
displayRoutes(app);

With TypeScript

import express from "express";
import { displayRoutes, DisplayRoutesConfig } from "express-route-visualizer";

const app = express();

// Define your routes
app.get("/api/users", (req, res) => res.send("Get users"));
app.post("/api/users", (req, res) => res.send("Create user"));

// Display routes with configuration
const config: DisplayRoutesConfig = {
  filterDomain: "users",
};

displayRoutes(app, config);

Configuration Options

You can customize the route display with the following options:

| Option | Type | Default | Description | | -------------------------- | ------------------------------- | ----------- | --------------------------------------------------------------------- | | domainFilter | string \| string[] | undefined | Filter routes by domain (e.g., "users" will match "/api/users/*") | | showUnprotectedOnly | boolean | false | Only show routes that don't require authentication | | isProtected | (route: RouteInfo) => boolean | undefined | Custom function to determine if a route is protected | | includeFilter | (route: RouteInfo) => boolean | undefined | Custom function to include only routes that match criteria | | excludeFilter | (route: RouteInfo) => boolean | undefined | Custom function to exclude routes that match criteria | | protectionMiddlewareName | string \| string[] | undefined | Name or names of middleware functions that indicate a protected route |

Authentication and Protected Routes

Routes are only marked as protected when you provide either:

  1. A custom isProtected function, or
  2. A specific middleware name via protectionMiddlewareName

By default, all routes are considered unprotected unless you specify how to identify protected routes.

Example with protectionMiddlewareName

// Specify which middleware indicates a protected route
displayRoutes(app, {
  protectionMiddlewareName: "requiresAuthentication",
});

Example with custom isProtected function

// Use a custom function to determine if routes are protected
displayRoutes(app, {
  isProtected: (route) => {
    // Consider routes with 'admin' in the path as protected
    return route.path.includes("admin") || route.middlewares.some((middleware) => middleware.name === "requiresAuthentication");
  },
});

Example with multiple protection middleware names

// Specify multiple middleware names that indicate protected routes
displayRoutes(app, {
  protectionMiddlewareName: ["requiresAuthentication", "requiresAdmin", "checkJwt"],
});

Advanced Examples

Custom Filtering

// Show only GET routes
displayRoutes(app, {
  includeFilter: (route) => route.method === "GET",
});

// Exclude auth routes
displayRoutes(app, {
  excludeFilter: (route) => route.path.includes("/auth"),
});

// Custom protection detection
displayRoutes(app, {
  isProtected: (route) => {
    // Consider routes with 'admin' in the path as protected
    return route.path.includes("/admin") || route.middlewares.some((middleware) => middleware.name === "requireAuth");
  },
});

Filtering by Multiple Domains

// Show routes from multiple domains
displayRoutes(app, {
  filterDomain: ["users", "products"],
});

Development

Linting

# Run linting
npm run lint

Running Tests

# Run tests
npm test

CI/CD

This project uses GitHub Actions for continuous integration. The following checks run on each push to main and pull request:

  • Linting (ESLint)
  • Type checking (TypeScript)
  • Building the project
  • Running tests

You can see the status of these checks in the GitHub repository under the "Actions" tab.

License

MIT