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

@mena-emad/documind

v1.0.5

Published

AI-Powered Swagger/OpenAPI Documentation Generator for Express.js projects with intelligent context stitching.

Readme

DocuMind

npm version Version License Language

AI-Powered Swagger/OpenAPI Documentation Generator for Express.js projects with intelligent context stitching.

🚀 Why DocuMind?

DocuMind is designed to fix the common problem of shallow or empty generated API docs. Instead of only parsing route definitions, it intelligently collects surrounding business logic so Gemini understands each endpoint in context.

  • Extracts routes, controllers, services, models, and validations
  • Encourages deep summaries and descriptions from Gemini
  • Prevents empty paths and weak documentation
  • Keeps generated output aligned with your implementation

🎯 Showcase

Input

A simple Express route plus related service and validation code.

// src/routes/auth.ts
router.post('/login', authController.login);

Output

openapi: 3.0.0
info:
  title: DocuMind Generated API
  version: 1.0.0
  description: Automated OpenAPI documentation generated by DocuMind AI.
paths:
  /login:
    post:
      tags:
        - Auth
      summary: Authenticate user and issue a JWT token.
      description: |
        Verifies credentials against the hashed user password, checks authorization
        roles, signs a JWT token, and returns a session payload.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: User authenticated successfully.
components:
  schemas:
    LoginRequest:
      type: object
      properties:
        email:
          type: string
          format: email
        password:
          type: string

🧠 How it Works

Context Stitching

DocuMind attaches nearby compute context to route files so Gemini sees the full backend flow.

flowchart LR
  A[Route File] --> B[Controller Code]
  A --> C[Service Logic]
  A --> D[Validation / Models]
  B --> E[AI Prompt]
  C --> E
  D --> E
  E --> F[Gemini AI]
  F --> G[OpenAPI Output]

Generation Flow

flowchart TD
  A[CLI Start] --> B[Parse CLI Options]
  B --> C[Scan Project Directory]
  C --> D[Filter Express Route Files]
  D --> E[Collect Related Context]
  E --> F[Call Gemini Model]
  F --> G[Defensive Merge Output]
  G --> H[Write swagger.yaml / json]

✨ Key Features

  • Smart File Scanning: finds Express route files across the project.
  • Context Stitching: includes controllers, services, models, and validation code.
  • Defensive Merging: merges AI-generated paths and schemas safely.
  • Rich Descriptions: forces Gemini to explain workflows like hashing, JWT creation, roles, and errors.
  • Interactive CLI: animated progress using ora.

🧰 Tech Stack

  • Node.js (>= 18.0.0)
  • TypeScript
  • Google Gen AI SDK (@google/genai)
  • Commander.js
  • Ora
  • Dotenv
  • yaml

📥 Installation

Global

npm install -g @mena-emad/documind

Local

git clone https://github.com/mena-emad/DocuMind.git
cd DocuMind
npm install
npm run build

Run in development mode:

npm run dev

Run locally:

npx @mena-emad/documind

🔧 Environment Variables

DocuMind reads the Gemini API key from .env:

DOCUMIND_API_KEY=your_gemini_api_key_here

Or pass the key directly using -k.

▶️ Usage

documind [options]

CLI Options

| Option | Description | Default | |---|---|---| | -k, --key <api-key> | Gemini API Key | DOCUMIND_API_KEY from .env | | -d, --dir [directory] | Directory to scan | ./ | | -o, --output [file-name] | Output filename | swagger.yaml | | --title [title] | OpenAPI info.title | auto-generated | | --api-version [version] | OpenAPI info.version | auto-generated | | --desc [description] | OpenAPI info.description | auto-generated | | -v, --version | Show CLI version | - |

Examples

Generate default output:

documind

Generate docs for a custom source directory:

documind -d ./src -o api-docs.yaml

Use the API key directly:

documind -k sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Provide OpenAPI metadata:

documind --title "My App API" --api-version "2.0.0" --desc "AI-generated Swagger docs from Express source code."

🔍 How DocuMind Processes Code

  1. Scan files
    • Recursively collect .js and .ts files.
  2. Filter Express routes
    • Detect route patterns and Express router usage.
  3. Gather related context
    • Add matching service, controller, model, and validation files.
  4. Ask Gemini
    • Send a prompt that demands valid OpenAPI JSON and rich documentation.
  5. Merge outputs defensively
    • Combine returned paths and components while handling missing or malformed sections.
  6. Write output
    • Save YAML or JSON based on the requested filename.

👨‍💻 About the Author

Built by Mena Emad Sawares.

📜 License

DocuMind is released under the MIT License.