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

docify-api

v2.0.2

Published

**I had already built this project before, it was just in a repository with some problems, hence the fast commit times.**

Downloads

482

Readme

I had already built this project before, it was just in a repository with some problems, hence the fast commit times.

🚀 API Documentation Middleware (CSM)

Effortlessly generate structured, real-time API documentation for your Express applications.


✨ Overview

CSM (Custom Server Middleware) is a powerful and minimal middleware designed to automatically generate and serve API documentation in Express-based applications.

Built with simplicity and flexibility in mind, CSM integrates seamlessly into your backend and exposes a clean documentation endpoint with almost zero configuration.


⚡ Why CSM?

  • 🔌 Plug & Play — Drop it into your Express app and it just works
  • 📄 Auto Documentation — No need to manually maintain docs
  • ⚙️ Configurable — Define your own route and environment mode
  • 🌐 Frontend Ready — Easily connect with any frontend
  • 🧠 Developer Friendly — Designed for speed and clarity

📦 Installation

npm install docify-api

or

pnpm add docify-api

🛠 Requirements

  • Node.js 18+
  • MongoDB database
  • Express application

⚙️ Environment Setup

Create a .env file in the root of your project:

MONGO_URL=your_mongodb_connection_string

🚀 Quick Start

import express from 'express';
import DocifyApi from 'docify-api';
import mongoose from 'mongoose';
import cors, { type CorsOptions } from 'cors';
import 'dotenv/config.js';

(async () => {
    const URL = process.env.MONGO_URL;
    if (!URL) throw new Error('MONGO_URL is not defined in environment variables');
    await mongoose.connect(URL);
})();

const allowedOrigins: string[] = ['http://localhost:5173', 'http://localhost:3000'];
const corsOptions: CorsOptions = {
    origin: (origin, callback) => {
        if (!origin) return callback(null, true);
        if (allowedOrigins.includes(origin)) return callback(null, true);
        return callback(new Error('Not allowed by CORS'));
    },
    credentials: true,
    optionsSuccessStatus: 200,
};

const app = express();

app.use(cors(corsOptions));
app.use(DocifyApi({ mode: 'development', title: 'My API Documentation' }));

app.listen(3000, () => console.log('Server running on http://localhost:3000'));

🧠 How It Works

CSM acts as an Express middleware that:

  • Hooks into your application lifecycle
  • Collects and structures API-related data
  • Generates a documentation layer dynamically
  • Serves it through a configurable endpoint

No manual documentation writing required.


⚠️ Important Notes

  • MongoDB must be connected before initializing the middleware
  • CORS should be configured properly if used with a frontend
  • Designed primarily for development and internal tooling (depending on configuration)

🧪 Example Use Case

Perfect for:

  • Internal tools
  • Rapid prototyping
  • Developer dashboards
  • API testing environments
  • Portfolio projects

🛡 Error Handling

Common issues:

  • MONGO_URL is not defined → Ensure .env is configured
  • ❌ Connection timeout → Verify MongoDB connection
  • ❌ CORS errors → Adjust allowed origins

📁 Project Structure (Suggested)

project/
├── src/
├── dist/
├── .env
├── package.json
└── server.ts

🤝 Contributing

Contributions are welcome and appreciated.

# Fork the repo
# Create your feature branch
git checkout -b feature/amazing-feature

# Commit your changes
git commit -m "Add amazing feature"

# Push to the branch
git push origin feature/amazing-feature

Then open a Pull Request.


📄 License

MIT License


💡 Author

Wilfryn Viloria Rosario