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

radish-nestjs-cli

v1.1.2

Published

一个快速创建 nestJs 后端 api 项目的脚手架工具.

Readme

Radish NestJS CLI

一个快速创建 NestJS 后端 API 项目的脚手架工具.

功能特性

  • 交互式创建项目: 通过友好的命令行交互引导用户创建项目
  • 多数据库支持: 支持 MongoDB 和无数据库模式
  • 开箱即用的模板: 预配置完整的 NestJS 项目结构
  • 自动依赖管理: 支持自动升级和安装依赖
  • Git 集成: 可选初始化 Git 仓库
  • 优雅错误处理: 完善的异常捕获和用户友好的错误提示
  • 生命周期管理: 自动清理未完成的项目, 支持优雅退出

系统要求

  • Node.js >= 18.0.0
  • npm 或其他包管理器

安装

全局安装

npm install -g radish-nestjs-cli

使用 npx

无需安装, 直接使用:

npx radish-nestjs-cli

使用指南

基本使用

运行以下命令开始创建项目:

radish-nestjs-cli

或使用 npx:

npx radish-nestjs-cli

交互流程

脚手架会依次询问以下问题:

  1. 项目名称: 输入项目名称 (仅支持字母、数字、连字符和下划线)
  2. 数据库选择: 选择数据库类型 (MongoDB 或无数据库)
  3. 升级依赖: 是否将依赖升级到最新版本
  4. 安装依赖: 是否自动安装项目依赖
  5. Git 初始化: 是否初始化 Git 仓库

使用示例

$ radish-nestjs-cli

🌱 Radish NestJS CLI

? 请输入项目名称: my-awesome-api
? 请选择数据库: MongoDB
? 是否升级依赖到最新版本? 是
? 是否安装依赖? 是
? 是否初始化 Git 仓库? 是

📦 开始创建项目: my-awesome-api

✔ 项目目录创建成功
✔ 模板文件复制成功

⏳ 升级依赖到最新版本...
✔ 依赖升级成功

⏳ 安装依赖...
✔ 依赖安装成功

⏳ 初始化 Git 仓库...
✔ Git 仓库初始化成功

✅ 项目创建成功!

下一步:
  cd my-awesome-api
  npm run start:dev

项目模板

基础模板 (无数据库)

生成的项目包含:

  • NestJS 核心框架配置
  • ESLint 和 Prettier 代码规范
  • 环境变量管理 (.env)
  • 健康检查模块
  • 全局异常过滤器
  • 响应拦截器
  • 生命周期钩子管理

MongoDB 模板

在基础模板的基础上添加:

  • Mongoose 集成配置
  • MongoDB 连接管理
  • 数据库健康检查

项目结构

生成的项目结构如下:

my-awesome-api/
├── src/
│   ├── common/
│   │   ├── config/           # 配置文件
│   │   ├── filters/          # 异常过滤器
│   │   ├── interceptors/     # 拦截器
│   │   └── services/         # 公共服务
│   ├── health/               # 健康检查模块
│   ├── app.module.ts         # 应用主模块
│   └── main.ts               # 应用入口
├── .env.development          # 开发环境变量
├── .env.production           # 生产环境变量
├── .gitignore
├── .prettierrc
├── eslint.config.mjs
├── nest-cli.json
├── package.json
├── tsconfig.json
└── tsconfig.build.json

开发指南

克隆仓库

git clone <repository-url>
cd radish-nestjs-cli

安装依赖

npm install

本地测试

node bin/index.js

链接到全局

在开发过程中, 可以将本地版本链接到全局:

npm link

然后可以在任何地方使用:

radish-nestjs-cli

取消链接

npm unlink -g radish-nestjs-cli

技术栈

  • Node.js: JavaScript 运行时
  • inquirer: 交互式命令行界面
  • chalk: 终端样式美化
  • ora: 优雅的终端加载动画

常见问题

Node.js 版本要求

如果遇到版本错误提示:

❌ Node.js 版本过低, 需要 v18+ , 当前版本: vX.X.X

请升级 Node.js 到 18.0.0 或更高版本.

项目名称验证错误

项目名称只能包含:

  • 字母 (a-z, A-Z)
  • 数字 (0-9)
  • 连字符 (-)
  • 下划线 (_)

中断创建过程

如果在创建过程中按下 Ctrl+C 中断, 脚手架会自动清理已创建的未完成项目目录.

贡献指南

欢迎贡献代码! 请遵循以下步骤:

  1. Fork 本仓库
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

许可证

本项目采用 UNLICENSED 许可证.

作者

Radish

致谢

感谢以下开源项目: