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-to-postman

v1.1.3

Published

CLI tool to read an Express.js project and generate a Postman collection JSON

Readme

express-to-postman

express-to-postman

Generate Postman Collections automatically from your Express.js application routes.

Features

  • Auto-detect Express routes including nested routers
  • Supports both JavaScript (ESM/CJS) and TypeScript entry files
  • Bundles local route modules while externalizing npm dependencies
  • Generates a valid Postman Collection v2.1 JSON file
  • Groups routes by first URL segment for better organization
  • CLI tool with simple usage and flexible input/output options

Installation

Install globally for system-wide use:

npm install -g express-to-postman

Or add as a dev dependency in your project:

npm install --save-dev express-to-postman

Basic Usage

Run the CLI against your Express app entry point:

express-to-postman -i path/to/your/express/app.js -o output/collection.json
  • -i, --input — Entry file path for your Express app (must export app)
  • -o, --output — Output path for the generated Postman collection JSON (default: postman.collection.json)
  • -v, --verbose — Enable verbose logging (default: false)

Detailed Examples

JavaScript (ESM)

Assume your server.js looks like:

import express from 'express';
export const app = express();
app.get('/users', (req, res) => res.json([]));

Generate a collection:

express-to-postman -i ./server.js -o ./users-collection.json

TypeScript

Support for .ts entry files is built-in via on-the-fly transpilation:

import express from 'express';
import router from './routes';
export const app = express();
app.use(router);
express-to-postman -i ./src/app.ts -o postman.json

Advanced Options

  • Auto-detect dependencies: Reads your project’s package.json to externalize all npm packages during bundling.
  • Custom grouping: Routes are grouped by the first path segment (/users, /comments).
  • Verbose logging: Pass -v or --verbose to print intermediate logs and the full generated collection JSON.

Troubleshooting

  • Missing dependencies: If the CLI complains it cannot find a package (e.g. express), make sure your app’s root package.json is detected correctly. The CLI searches upward from your entry file for package.json.
  • Routes not detected: Verify that your Express app exports a named app and that routes are registered before app.listen().

Configuration

You can also import and use generateCollection() programmatically in Node:

import { generateCollection } from 'express-to-postman';

(async () => {
  await generateCollection(
    './dist/app.js',
    './collection.json',
    true // verbose
  );
})();

License

project License