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

@idirdev/apidoc-gen

v1.0.0

Published

Generate API documentation from JSDoc comments in source files

Readme

apidoc-gen

[EN] Scan JavaScript/TypeScript source files and automatically generate Markdown API documentation from JSDoc comments and Express route definitions. [FR] Analysez des fichiers JavaScript/TypeScript et générez automatiquement une documentation API en Markdown à partir des commentaires JSDoc et des routes Express.


Features / Fonctionnalités

[EN]

  • Recursively walks a source directory, skipping node_modules and .git
  • Parses all JSDoc comment blocks (/** ... */) into structured objects
  • Extracts @param, @returns, and any arbitrary @tag annotations
  • Detects Express/Router route declarations (app.get, router.post, etc.)
  • Renders a clean Markdown document with Endpoints and Functions sections
  • Outputs to stdout or to a file with -o
  • Fully programmatic API — integrate into build scripts or CI pipelines

[FR]

  • Parcourt récursivement un répertoire source en ignorant node_modules et .git
  • Analyse tous les blocs JSDoc (/** ... */) en objets structurés
  • Extrait les annotations @param, @returns et toute balise @tag arbitraire
  • Détecte les déclarations de routes Express/Router (app.get, router.post, etc.)
  • Génère un document Markdown propre avec sections Endpoints et Functions
  • Sortie vers stdout ou vers un fichier avec -o
  • API entièrement programmable — intégrable dans des scripts de build ou CI

Installation

npm install -g @idirdev/apidoc-gen

CLI Usage / Utilisation CLI

# Scan ./src and print to stdout (scan ./src, affiche sur stdout)
apidoc-gen

# Scan a specific directory (scanner un dossier spécifique)
apidoc-gen ./lib

# Write output to a file (écrire la sortie dans un fichier)
apidoc-gen ./src -o API.md

# Show help (afficher l'aide)
apidoc-gen --help

Example Output / Exemple de sortie

# API Documentation

## Endpoints

### GET /users

### POST /users/:id/update

## Functions

### Create a new user account

**Parameters:**
- `name` (string): Full name of the user
- `email` (string): Email address

**Returns:** Promise - Resolves with the created user object

### Validate email format

**Parameters:**
- `email` (string): Email string to validate

**Returns:** boolean - true if valid

API (Programmatic) / API (Programmation)

const { parseJSDoc, parseRoutes, generateMarkdown, scanDir } = require('@idirdev/apidoc-gen');

// Parse JSDoc blocks from a source string (parser des blocs JSDoc depuis une chaîne)
const source = `
/**
 * Fetch a user by ID.
 * @param {string} id  The user's unique identifier
 * @returns {Promise} Resolves with the user object
 */
`;
const docs = parseJSDoc(source);
// => [{ description: "Fetch a user by ID.", params: [{type:"string", name:"id", ...}], returns: {...} }]

// Detect Express routes in source code (détecter des routes Express dans du code source)
const routes = parseRoutes(`app.get('/health', handler); router.post('/users', create);`);
// => [{ method: 'GET', path: '/health' }, { method: 'POST', path: '/users' }]

// Render Markdown from parsed data (générer du Markdown depuis les données parsées)
const md = generateMarkdown(docs, routes);

// Scan an entire directory and generate docs (scanner un répertoire entier)
const { docs: allDocs, routes: allRoutes } = scanDir('./src');
const fullDoc = generateMarkdown(allDocs, allRoutes);
require('fs').writeFileSync('API.md', fullDoc);

License

MIT © idirdev