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

api-docs-creator

v1.0.13

Published

Simple file-based REST API documentation builder with testing

Readme

API Docs Creator

Express middleware for creating beautiful API documentation and testing interfaces. No setup required - just add it to your Express app!

Installation

npm install api-docs-creator

Quick Start

const express = require("express");
const { apiDocsCreator, defaultPath } = require("api-docs-creator");

const app = express();

// Add API Docs Creator middleware
app.use(
  defaultPath,
  apiDocsCreator({
    name: "My API",
    description: "API documentation and testing",
    baseUrl: "https://api.myproject.com",
  })
);

// Your existing API routes
app.get("users", (req, res) => {
  res.json({ users: [] });
});

app.listen(3000, () => {
  console.log("Server running on http://localhost:3000");
  console.log("API Docs: http://localhost:3000/api-docs");
});

Configuration Options

| Option | Type | Default | Description | | ---------------------- | ------- | ----------------------------------------- | ------------------------------- | | name | string | "API Documentation" | Project name | | description | string | "API documentation and testing interface" | Project description | | version | string | "1.0.0" | API version | | author | string | "API Team" | Author name | | baseUrl | string | "http://localhost:3000" | Base API URL for testing | | path | string | "/api-creator" | Mount path (auto-detected) | | allowExternalEdit | boolean | false | Allow editing from external IPs | | theme | string | "dark" | UI theme | | primaryColor | string | "#6B7280" | Primary color | | dataDir | string | "./api-docs" | Data storage directory | | createSampleEndpoint | boolean | true | Creates sample endpoint |

Advanced Usage

const express = require("express");
const { apiDocsCreator, defaultPath } = require("api-docs-creator");

const app = express();

// Advanced configuration
app.use(
  defaultPath,
  apiDocsCreator({
    name: "Advanced API",
    description: "Full featured API documentation",
    version: "2.0.0",
    author: "Development Team",
    baseUrl: process.env.API_BASE_URL || "http://localhost:3000",
    allowExternalEdit: process.env.NODE_ENV === "development",
    dataDir: "./custom-api-docs",
    theme: "dark",
    primaryColor: "#3B82F6",
    createSampleEndpoint: false,
  })
);

app.listen(3000);

Features

  • 🚀 Zero Configuration - Works out of the box
  • 📝 Visual Editor - Create and edit API endpoints with a beautiful UI
  • 🧪 Built-in Testing - Test your APIs directly from the documentation
  • 📁 Organized Structure - Group endpoints in folders
  • 🔒 Smart Permissions - Edit mode on localhost, read-only elsewhere
  • 🎨 Customizable - Themes and colors
  • 📱 Responsive - Works on all devices
  • Fast - No database required, uses JSON files

File Structure

The middleware creates an api-docs directory (or custom dataDir) with this structure:

api-docs/
├── endpoints/
│   ├── users/
│   │   ├── get-users.json
│   │   └── create-user.json
│   └── auth/
│       ├── login.json
│       └── logout.json
└── sockets/
    └── (WebSocket documentation - future feature)

Demo

Run a demo server to see API Docs Creator in action:

npx api-docs-creator demo

Then visit: http://localhost:3000/api-docs

CLI Commands

# Show usage examples
npx api-docs-creator usage

# Run demo server
npx api-docs-creator demo --port 3000 --path /docs

Examples

Basic Integration

const express = require("express");
const { apiDocsCreator, defaultPath } = require("api-docs-creator");

const app = express();

// Mount at /api-docs-creator
app.use(defaultPath, apiDocsCreator());

app.listen(3000);

Multiple Documentation Sites

const app = express();

// Public API docs
app.use(
  defaultPath,
  apiDocsCreator({
    name: "Public API",
    allowExternalEdit: false,
  })
);

// Internal API docs
app.use(
  defaultPath,
  apiDocsCreator({
    name: "Internal API",
    allowExternalEdit: true,
    dataDir: "./internal-api-docs",
  })
);

With Authentication

const app = express();

// Protect with authentication middleware
app.use(
  defaultPath,
  authMiddleware,
  apiDocsCreator({
    name: "Admin API",
    allowExternalEdit: true,
  })
);

Browser Support

  • Chrome 70+
  • Firefox 65+
  • Safari 12+
  • Edge 79+

License

MIT

Contributing

Pull requests welcome! Please read the contributing guidelines first.