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

chanjs-cli

v1.0.0

Published

ChanJS / ChanJS-Hono 官方脚手架 CLI。可选框架(chanjs / chanjs-hono)× 类型(简单 / 完整),一条命令生成标准项目模板。

Readme

Chanjs-cli

ChanJS / ChanJS-Hono 官方脚手架 CLI

一条命令,即可在 chanjs(Express 5 轻量 MVC)与 chanjs-hono(Hono + Drizzle 轻量 MVC)之间自由创建标准项目模板。支持「简单 / 完整」两档模板类型,覆盖从最小可运行骨架到全套工程化配置。

特性

  • 双框架:chanjs 与 chanjs-hono 一键切换,风格与 API 对齐
  • 双类型:simple 最小可运行(hello world);full 完整工程(env / config / 数据库 / 安全 / 部署全套)
  • 零第三方依赖:命令解析、交互选择、模板拷贝全部基于 Node 原生能力实现
  • 覆盖保护:目标目录非空时交互确认,或 -y 强制覆盖
  • 双重 bin:chanjs-cli 与 create-chanjs 均可调用

环境要求

  • Node.js >= 22.0.0(模板内置 node --watch、--env-file 能力)

安装

npm i -g chanjs-cli

本地开发/预览时也可用 npm link 挂载到全局:

cd chanjs-cli
npm link

快速开始

交互式创建(自动让你选择框架与模板类型):

chanjs-cli create my-app

直接指定框架和类型(非交互,适合脚本/CI):

chanjs-cli create my-app -f chanjs -t full

进入项目并启动:

cd my-app
npm install
npm run dev        # 访问 http://localhost:3000

命令

| 命令 | 说明 | | --- | --- | | create <项目名> | 创建项目,交互选择框架与模板类型 | | -v / --version / version | 查看 CLI 版本号 | | -h / --help / help | 查看帮助 |

create 选项:

| 选项 | 说明 | | --- | --- | | -f, --framework <chanjs\|hono> | 目标框架(缺省交互选择) | | -t, --type <simple\|full> | 模板类型(缺省交互选择) | | -y, --force | 目录已存在时自动覆盖,不弹确认 |

模板矩阵

| 框架 | simple(最小可运行) | full(完整工程) | | --- | --- | --- | | chanjs | templates/chanjs/simple/ | templates/chanjs/full/ | | chanjs-hono | templates/hono/simple/ | templates/hono/full/ |

simple · 最小可运行

  • app.js 入口(实例化框架 → 启动生命周期 → 监听端口)
  • config/ 配置聚合(app / modules / database / view)
  • Home 模块(controller / service / router),根路径输出 hello world
  • .env.dev / .env.prd 双环境配置

full · 完整工程

在 simple 基础上补充:

  • 安全:WAF 防火墙 + 全局限流 + 恶意 IP 封禁
  • 鉴权:JWT 中间件(app/middleware/auth.js,演示 /admin/info 接口)
  • 数据库:MySQL / SQLite(chanjs)/ PostgreSQL(chanjs-hono)多库可切换
  • 统一响应:success / fail 返回体
  • art-template 视图引擎
  • PM2 集群部署配置(pm2.json)

生成项目的规范结构

my-app/
├── app/
│   ├── middleware/        # 应用级中间件(full)
│   └── modules/
│       ├── home/          # Home 模块
│       │   ├── controller/
│       │   ├── service/
│       │   ├── repository/   # full
│       │   └── router.js
│       └── common/        # 公共路由 /health(full)
├── config/                # 统一配置聚合
├── view/                  # art-template 视图
├── public/                # 静态资源
├── app.js                 # 服务入口
├── .env.dev / .env.prd    # 双环境配置
└── pm2.json               # PM2 部署(full)

新增业务模块:在 app/modules/ 下新建目录(含 controller/、service/、router.js),并在 config/modules.js 中登记即可。

包结构

chanjs-cli/
├── bin/cli.js         # 命令行入口(命令解析:create / -v / -h)
├── lib/create.js      # 模板拷贝、占位符替换、覆盖保护
├── lib/utils.js       # 零依赖工具(选择 / 校验 / 版本 / 帮助)
└── templates/         # 四套项目模板(chanjs·hono × simple·full)

发布

npm pack               # 预览发布产物(应先确认仅含 bin/ lib/ templates/ README.md)
npm login
npm publish            # 或 npm publish --dry-run 先行演练

包清单由 package.json 的 files 白名单控制,不会带入无关文件。

相关项目

  • chanjs — 基于 Express 5 的轻量 MVC 框架
  • chanjs-hono — 基于 Hono + Drizzle 的轻量 MVC 框架

License

ISC