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

@dogulabs/api-docs

v1.0.0

Published

Node.js script to generate API documentation paths from templates

Readme

API Docs Generator - Node.js Version

A Node.js conversion of the original Bash script for generating OpenAPI/Swagger documentation paths from templates.

Prerequisites

  • Node.js 20.0.0 or higher
  • npm or yarn

Installation

npm install

This installs the js-yaml dependency needed to parse YAML files.

Usage

node api-docs-generator.js

Or if you installed it globally:

npm install -g .
api-docs-generator

Features

  • Interactive CLI - Prompts user for API details (method, path, title, domain, author)
  • Validation - Validates HTTP methods, paths, and author codes
  • YAML Parsing - Reads API version from OpenAPI spec files
  • Parameter Extraction - Automatically extracts path and query parameters from URLs
  • Template Generation - Generates API documentation files from templates with variable substitution
  • Author Tracking - Maps author codes (daf, kam, muf, nov, sal) to full names

Configuration Files

The script expects these paths to exist:

  • API Spec: default to resource/api-docs/v1/api-docs.yaml (or user-provided path)

Output files are generated in: {API_SPEC_DIR}/paths/{domain}/{method}-{operation}.yaml

Prompts

When run, the script will ask for:

  1. HTTP Method - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE, CONNECT
  2. Path - API path with optional path parameters in {param} format
  3. Title - Human-readable title for the endpoint
  4. Domain - Category/tag for the endpoint (e.g., "users", "products")
  5. Author - Code for who created this using GitHub username

Path Examples

Valid paths:

/users
/users/{userId}
/users/{userId}/posts?filter=active&sort=date
/products/{id}/reviews

Invalid paths:

users                    # Must start with /
/users/:id               # Use {id} instead of :id
/users?query=value       # Query string should be after path validation

Path Parameter Handling

Path Parameters (in {curly braces}):

  • Automatically extracted from path
  • Marked as required: true in generated YAML
  • Type set to string

Query Parameters (after ?):

  • Extracted from URL query string
  • Marked as in: query in generated YAML
  • Schema stub generated for manual completion

Output

The script generates a YAML file with:

/{path}:
  {method}:
    operationId: {operation_id}
    summary: {title}
    tags:
      - {domain}
    parameters: [...]
    responses:
      '200':
        description: Success
        content:
          application/json:
            schema:
              type: object
    x-author: {author}
    x-api-version: {version}

Troubleshooting

"API spec not found"

  • Provide the correct path to your OpenAPI specification file, relative to your caller location when prompted

"Could not read info.version"

  • Ensure the API spec has a valid info.version field in YAML format

Novando