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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@snap-api-docs/generator

v1.0.3

Published

Generador de documentación OpenAPI minimalista.

Readme

Snap API Docs ⚡

Documentación de API en un chasquido. Genera especificaciones OpenAPI 3.0 (Swagger) escaneando comentarios JSDoc. Soporta sintaxis simple y YAML avanzado. Es agnóstico al framework.

Version MIT License

Snap API Docs es una suite pensada para desarrolladores que no quieren perder tiempo escribiendo YAML gigantes.

  • 📦 @snap-api-docs/cli → Genera el JSON escaneando tus comentarios.
  • 🎨 @snap-api-docs/ui → Interfaz visual para mostrar la documentación (Swagger UI limpio).

🚀 Instalación

Instalá cada herramienta según tu uso:

# 1. Generador (solo desarrollo)
npm install @snap-api-docs/cli --save-dev

# 2. Interfaz visual (para servir la documentación)
npm install @snap-api-docs/ui

⚡ Guía Rápida

1. Agregá el script

"scripts": {
  "docs": "snap-docs"
}

2. Comenta tu código

/**
 * @endpoint GET /api/users
 * @group Usuarios
 * @desc Obtiene la lista de usuarios
 * @response 200 {object} - Lista de usuarios recuperada
 */
app.get('/api/users', (req, res) => { ... });

3. Generá la documentación

npm run docs

Esto crea una carpeta docs/ o src/docs/ con documentation.json.


📚 Sintaxis de Comentarios

Snap API Docs soporta dos modos: Simple (JSDoc) y Avanzado (YAML).


⭐ Modo Simple (Recomendado)

Definir un endpoint

/**
 * @endpoint POST /api/login
 * @group Auth
 * @desc Inicia sesión y retorna token
 * @body {object} - Credenciales {email, password}
 * @response 200 {object} - Login exitoso
 */

Parámetros

/**
 * @endpoint GET /api/users/:id
 * @param {string} id.path - El UUID del usuario
 * @param {string} role.query - Filtrar por rol
 */

Usando Schemas Reutilizables

1. Definir el Schema

/**
 * @schema User
 * @field {string} id - UUID único
 * @field {string} email - Correo del usuario
 */
export class User { ... }

2. Usarlo

/**
 * @endpoint GET /api/users
 * @response 200 {User[]} - Retorna un array de usuarios
 */

🧩 Modo Avanzado (YAML)

/**
 * @openapi
 * /api/complejo:
 *   post:
 *     summary: Ruta compleja
 *     responses:
 *       200:
 *         description: OK
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/User'
 */

🎨 Integración de la UI

@snap-api-docs/ui devuelve un HTML listo para servir con cualquier framework.

Con Express

import { getHtml } from '@snap-api-docs/ui';
import express from 'express';

const app = express();

app.use('/docs/json', express.static('docs/documentation.json'));

app.get('/docs', (req, res) => {
  res.send(getHtml('/docs/json', { title: 'Mi API Documentation' }));
});

app.listen(3000);

Con Fastify

import { getHtml } from '@snap-api-docs/ui';

fastify.get('/docs', (req, reply) => {
  const html = getHtml('/docs.json', { title: 'Fastify Docs' });
  reply.type('text/html').send(html);
});

⚙️ Configuración CLI

| Flag | Alias | Descripción | Default | | -------- | ----- | ------------------ | ---------------------- | | --input | -i | Patrón de archivos | **/*.{js,ts} | | --output | -o | Archivo de salida | Automático (src/docs/) | | --title | -t | Título de la API | API Docs | | --debug | — | Logs detallados | false |


📄 Licencia

Este proyecto está bajo licencia MIT. MIT License