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

swt-documentation

v1.2.3

Published

Custom API Documentation Generator

Readme

swt-documentation

swt-documentation is a modern, user-friendly API documentation generator, inspired by Swagger. It allows developers to quickly set up beautiful, interactive documentation for their APIs with minimal configuration. Perfect for teams who want a clean, easy-to-use interface for their endpoints.


Features

  • Easy to set up using a CLI
  • Dynamic rendering of API endpoints, requests, and responses
  • Supports success and error responses
  • Sidebar navigation with category filtering
  • Searchable API categories and requests
  • Optional Authorization display
  • Fully responsive and mobile-friendly design
  • Smooth scrolling to selected API sections
  • Internal locked CSS and JS (users can edit global.css and endpoints.json)

Installation

Install via npm:

npm install swt-documentation
npx swt-docs

This will create a documentation folder in your project containing:

  • global.css → editable CSS for customizing styles
  • endpoints.json → editable file for your API endpoints

Usage

1. Serve your docs in a Node.js project

#!/usr/bin/env node
import express from "express";
import { serveDocs } from "swt-documentation";

const app = express();

// Serve documentation at /docs
serveDocs(app, "/docs");

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
  console.log(`Documentation available at http://localhost:${PORT}/docs`);
});

serveDocs(app, "/docs") serves the documentation at the route /docs. You can change the route if needed.


2. Configure endpoints.json

This is where you define your API endpoints. Example:

{
  "meta": {
    "title": "Documentation By SWT",
    "header": "Backend API Documentation By SWT",
    "description": "AI-native, beautiful API documentation made easy."
  },
  "endpoints": [
    {
      "category": "Auth",
      "title": "Login",
      "path": "/auth/login",
      "method": "POST",
      "summary": "Login user",
      "requestBody": "{ email, password }",
      "authorization": false,
      "responseSuccess": "{ \"status\": \"success\", \"token\": \"jwt_token_here\" }",
      "responseError": [
        { "status": "error", "message": "Invalid email" },
        { "status": "error", "message": "Password is required" }
      ]
    },
    {
      "category": "User",
      "title": "Get Profile",
      "path": "/user/profile",
      "method": "GET",
      "summary": "Get user profile",
      "requestBody": "-",
      "authorization": true,
      "responseSuccess": "{ \"id\": 1, \"name\": \"John Doe\", \"email\": \"[email protected]\" }",
      "responseError": [
        { "status": "error", "message": "User not found" }
      ]
    }
  ]
}

Update this file to reflect your API endpoints.


3. Customize global.css (optional)

Edit the global.css file in the documentation folder to change styles, colors, or fonts.


4. View your documentation

Start your Node.js app and open in a browser:

http://localhost:5000/docs
  • Sidebar shows categories (filterable)
  • Search API requests by title
  • Click an endpoint to see details: request, response, and optional authorization
  • Popup modal for code examples in Node.js, jQuery, Fetch, XMLHttpRequest, Python, etc.

5. Example Code Popup

Each endpoint has a Code button that opens a modal. Users can select from multiple languages:

  • Node.js (Axios)
  • jQuery AJAX
  • JavaScript Fetch
  • XMLHttpRequest
  • Python (requests)

The popup automatically renders the corresponding code snippet for the selected language.


Versions

[1.2.0] - 2025-08-27

  • Added popup code examples for multiple languages
  • Refactored serveDocs to fix static file issues
  • Improved sidebar search for categories and endpoints

[1.1.0] - 2025-08-27

  • Initial release supporting CLI and serveDocs integration

Screenshots

Here’s what your documentation will look like once set up:

swt-documentation-preview