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

@mazhu/apidoc-gen

v1.0.0

Published

从代码注释自动生成漂亮的 API 文档网站

Downloads

128

Readme

API Doc Generator

从代码注释自动生成漂亮的 API 文档网站。

特性

  • 🚀 简单易用 - 零配置即可生成文档
  • 🎨 主题系统 - 支持自定义主题
  • 📱 响应式设计 - 完美适配移动端
  • 🔍 搜索支持 - 快速查找 API
  • 🔄 热重载 - 开发时自动刷新
  • 🌐 一键部署 - 支持 GitHub Pages

安装

npm install -g @mazhu/apidoc-gen

快速开始

1. 初始化项目

apidoc-gen init

2. 编写 API 注释

/**
 * @api {get} /users 获取用户列表
 * @apiName GetUsers
 * @apiGroup User
 * @apiQuery {Number} [page=1] 页码
 * @apiQuery {Number} [limit=10] 每页数量
 * @apiSuccess {Object[]} users 用户列表
 * @apiSuccess {String} users.id 用户ID
 * @apiSuccess {String} users.name 用户名
 */

3. 生成文档

apidoc-gen build

4. 本地预览

apidoc-gen serve

5. 部署到 GitHub Pages

apidoc-gen deploy

支持的注释标签

| 标签 | 描述 | |------|------| | @api | 定义 API 方法和路径 | | @apiName | API 名称 | | @apiGroup | API 分组 | | @apiDescription | API 描述 | | @apiParam | 路径参数 | | @apiQuery | 查询参数 | | @apiBody | 请求体参数 | | @apiSuccess | 成功响应 | | @apiError | 错误响应 | | @apiHeader | 请求头 | | @apiExample | 示例代码 | | @apiVersion | API 版本 | | @apiPermission | 权限要求 | | @apiDeprecated | 已弃用标记 |

CLI 命令

# 初始化项目
apidoc-gen init

# 生成文档
apidoc-gen build
apidoc-gen build -c ./config.json

# 本地预览
apidoc-gen serve
apidoc-gen serve -p 8080
apidoc-gen serve -w  # 监视模式

# 部署到 GitHub Pages
apidoc-gen deploy

# 主题管理
apidoc-gen theme list
apidoc-gen theme create my-theme

配置文件

{
  "title": "My API Documentation",
  "description": "API documentation for my project",
  "version": "1.0.0",
  "srcDir": "./src",
  "outputDir": "./docs",
  "theme": "default",
  "baseUrl": "https://api.example.com",
  "include": ["**/*.js", "**/*.ts"],
  "exclude": ["node_modules/**", "test/**"]
}

自定义主题

# 创建新主题
apidoc-gen theme create my-theme

# 编辑主题文件
themes/my-theme/templates/
themes/my-theme/assets/

许可证

MIT

作者

Mike Wang [email protected]