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-collections-generator

v1.0.0

Published

Generate Postman-compatible API collections from Swagger/OpenAPI documentation. Supports all HTTP methods, path/query params, request bodies, auth, and more.

Readme

API Collection Generator

Generate Postman-compatible API collections from Swagger / OpenAPI documentation.
Designed for NestJS applications but works with any OpenAPI 3.x / Swagger 2.0 spec.

Features

  • All HTTP methods – GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
  • Request bodiesapplication/json, multipart/form-data, application/x-www-form-urlencoded, text/plain, application/xml
  • Path parameters{id} → Postman :id format with sample values
  • Query parameters – extracted from Swagger with descriptions and required flags
  • Header parameters – custom headers from Swagger spec
  • Authentication – Bearer token, Basic auth, API Key (header/query), OAuth2, OpenID Connect
  • Schema resolution – full $ref, allOf, oneOf, anyOf support with sample generation
  • Response examples – auto-generated response bodies from schemas
  • Folder grouping – by Swagger tags (default) or first path segment
  • Configurable – base URL, output path, collection name, and more
  • Collection variables{{base_url}}, {{access_token}}, {{api_key}}, etc.

Installation

npm install api-collections-generator

Usage (NestJS)

Basic

import GenerateAPICollection from "api-collections-generator";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";

const config = new DocumentBuilder()
  .setTitle("Your API")
  .setDescription("API description")
  .setVersion("1.0")
  .addBearerAuth()
  .build();

const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("api", app, document);

const generator = new GenerateAPICollection(document);
generator.generateAPICollection();
// → writes collection.json to your project root

With Options

const generator = new GenerateAPICollection(document, {
  baseUrl: "http://localhost:4000", // default: "http://localhost:3000"
  outputPath: "postman/my-api.json", // default: "collection.json"
  collectionName: "My Service API", // default: extracted from Swagger info.title
  groupByTags: true, // default: true (false = group by path segment)
  includeResponses: true, // default: true
});
generator.generateAPICollection();

Options Reference

| Option | Type | Default | Description | | ------------------ | --------- | ------------------------- | -------------------------------------------- | | baseUrl | string | "http://localhost:3000" | Base URL prepended to every request | | outputPath | string | "collection.json" | Output file path relative to process.cwd() | | collectionName | string | Swagger info.title | Name shown in Postman | | groupByTags | boolean | true | Group requests into folders by Swagger tags | | includeResponses | boolean | true | Include example responses in collection |

Output

A Postman Collection v2.1.0 JSON file importable via Postman → Import → Raw text / File.

The collection includes:

  • Folders organised by tag (or path)
  • Pre-filled request bodies with realistic sample values
  • Path and query parameters with descriptions
  • Auth headers derived from your Swagger security schemes
  • Collection-level variables for easy environment switching

Supported Swagger / OpenAPI Features

| Feature | Support | | --------------------------------- | -------------------------------------- | | OpenAPI 3.x paths | Yes | | Swagger 2.0 paths | Yes | | $ref schema references | Yes (recursive) | | allOf / oneOf / anyOf | Yes | | enum values | Yes (first value used) | | example / default values | Yes | | Nested objects & arrays | Yes | | File uploads (binary) | Yes (form-data) | | Security schemes | Bearer, Basic, API Key, OAuth2, OpenID | | Global & operation-level security | Yes | | Tags-based grouping | Yes | | Path-level parameters | Yes |

License

ISC