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

@kne/prompts-fastify-libs

v1.0.1

Published

Fastify 插件库开发辅助提示词集合,包含用户管理、消息发送、数据库集成、多租户架构、短链接生成、插件开发、单元测试等常用任务的 AI 提示词模板

Readme

Fastify 插件库 文档索引

本项目的文档集合旨在为 Fastify 应用开发提供全面的插件使用指导和最佳实践,包含用户管理、消息发送、数据库集成、多租户架构、短链接生成等常用任务的 AI 提示词模板。

文档列表

1. Fastify-Account 使用指南

功能: 用户账号管理插件,提供完整的用户注册、登录、认证、密码管理等功能,支持邮箱和手机号两种登录方式。

适用场景:

  • 需要用户系统的 Fastify 应用
  • 需要邮箱和手机号两种登录方式
  • 需要 JWT 认证机制

核心内容:

  • 配置选项详解(JWT、sendMessage 回调)
  • API 接口(账号相关、用户相关、管理员相关)
  • 认证中间件(user 认证、admin 认证)
  • 服务层方法(注册、登录、验证码验证等)
  • 数据模型(User、UserAccount、VerificationCode)

使用方式: 阅读 原文档 了解详情


2. Fastify-Message 使用指南

功能: 消息管理插件,支持邮件、短信等多渠道消息发送,提供模板管理和发送记录追踪功能。

适用场景:

  • 需要发送邮件通知的应用
  • 需要短信验证码功能
  • 需要消息模板管理

核心内容:

  • 模板系统(EJS 语法、模板变量、模板级别)
  • 核心服务(includeTemplate、messageTemplate、sendMessage)
  • 自定义发送器
  • 数据模型(Template、Record)

使用方式: 阅读 原文档 了解详情


3. Fastify-Namespace 使用指南

功能: 命名空间管理插件,用于组织和管理 Fastify 模块,实现模块化和配置共享。

适用场景:

  • 需要模块化组织代码
  • 需要命名空间隔离
  • 需要全局配置共享

核心内容:

  • 配置选项
  • 模块配置方式(数组、对象、函数)
  • 全局配置合并
  • 挂载事件钩子
  • 装饰器结构

使用方式: 阅读 原文档 了解详情


4. Fastify-Sequelize 使用指南

功能: Sequelize ORM 插件,提供数据库集成、模型管理、雪花ID生成等功能。

适用场景:

  • 需要数据库操作的 Fastify 应用
  • 需要 ORM 支持
  • 需要数据库同步和迁移

核心内容:

  • 配置详解(数据库配置、雪花ID、模型配置)
  • 模型定义(基础模型、关联关系)
  • 动态模型管理
  • CRUD 操作示例
  • 事务处理

使用方式: 阅读 原文档 了解详情


5. Fastify-Shorten 使用指南

功能: 短编码生成插件,用于生成和管理短链接或短编码,支持自定义有效期、自动去重、过期清理等功能。

适用场景:

  • 短链接服务
  • 邀请码生成
  • 临时访问凭证

核心内容:

  • 核心服务(sign、decode、getShorten、remove)
  • 认证中间件(code 认证)
  • 数据模型(Shorten)
  • 使用场景示例(短链接、邀请码、临时访问凭证、分享链接)

使用方式: 阅读 原文档 了解详情


6. Fastify-Tenant 使用指南

功能: 多租户管理插件,提供完整的租户系统解决方案,包括租户管理、用户管理、组织架构、角色权限、公司信息等核心功能。

适用场景:

  • 需要多租户架构的 SaaS 应用
  • 需要租户管理、用户管理
  • 需要组织架构和角色权限管理

核心内容:

  • 租户管理(创建、配置、监控)
  • 租户用户管理(创建、邀请、加入)
  • 组织架构管理
  • 角色权限管理
  • 公司信息管理
  • 认证中间件

使用方式: 阅读 原文档 了解详情


7. Fastify 业务插件开发指南

功能: 指导开发者构建功能完整、可扩展、易维护的 Fastify 业务插件包,通过合理的架构设计和模块划分,实现高内聚低耦合的插件系统。

适用场景:

  • 需要开发 Fastify 业务插件
  • 需要遵循最佳实践
  • 需要统一的架构设计

核心内容:

  • 核心架构设计(插件化、分层架构、命名空间)
  • 配置管理(默认配置、配置合并)
  • 认证与授权(多层认证、路由认证)
  • Service 层设计
  • Controller 层设计
  • 数据模型设计

使用方式: 阅读 原文档 了解详情


8. 单元测试编写指南

功能: 总结模块单元测试的通用编写过程,适用于类似的插件/模块开发项目。

适用场景:

  • 需要编写单元测试
  • 需要测试覆盖率
  • 需要遵循测试最佳实践

核心内容:

  • 测试框架配置
  • 测试结构设计
  • 测试用例编写原则(AAA 模式)
  • 测试覆盖维度
  • 断言最佳实践

使用方式: 阅读 原文档 了解详情


如何选择

| 需求 | 使用文档 | |------|----------| | 需要用户注册登录功能 | Fastify-Account 使用指南 | | 需要发送邮件或短信 | Fastify-Message 使用指南 | | 需要模块化组织代码 | Fastify-Namespace 使用指南 | | 需要数据库操作 | Fastify-Sequelize 使用指南 | | 需要生成短链接或邀请码 | Fastify-Shorten 使用指南 | | 需要多租户架构 | Fastify-Tenant 使用指南 | | 需要开发业务插件 | Fastify 业务插件开发指南 | | 需要编写单元测试 | 单元测试编写指南 |