nest-best-practices
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNestJS is a progressive Node.js framework for building efficient and scalable server-side applications. It uses TypeScript by default, supports both Express and Fastify, and provides an out-of-the-box application architecture inspired by Angular. NestJS combines elements of OOP, FP, and FRP, making it ideal for building enterprise-grade applications.
Skill based on NestJS documentation, updated 2026-03-28. Covers NestJS v11 with Express v5.
NestJS是一款渐进式Node.js框架,用于构建高效、可扩展的服务端应用。它默认使用TypeScript,同时支持Express和Fastify,并提供了受Angular启发的开箱即用应用架构。NestJS融合了面向对象编程(OOP)、函数式编程(FP)和函数响应式编程(FRP)的特性,非常适合构建企业级应用。
本指南基于NestJS文档编写,更新于2026年3月28日,涵盖NestJS v11与Express v5的内容。
How to Use This Skill
如何使用本指南
When generating NestJS code, read the relevant reference files below for the specific topic. The references contain current API patterns, correct import paths, and production-ready examples.
Always apply the production best practices below — these are patterns that matter in production and are easy to miss without explicit guidance.
在生成NestJS代码时,请阅读下方对应主题的参考文件。这些参考文件包含当前的API模式、正确的导入路径和生产环境可用的示例。
请始终遵循以下生产环境最佳实践——这些是生产环境中至关重要但若无明确指导容易遗漏的实现模式。
NestJS v11 Breaking Changes
NestJS v11 破坏性变更
Be aware of these when generating code for NestJS v11+:
在为NestJS v11+生成代码时,请注意以下变更:
Node.js v20+ Required
Node.js v20+ 是最低要求
Node.js v16 and v18 are no longer supported. Always target Node.js v20+.
Node.js v16和v18不再被支持,请始终以Node.js v20+为目标版本。
Express v5 Route Matching
Express v5 路由匹配规则
NestJS v11 uses Express v5 by default. Route patterns have changed:
| Express v4 (Old) | Express v5 (New) | Notes |
|---|---|---|
| | Wildcards must be named |
| | Braces make path optional (matches root) |
| Not supported | Use braces |
| Regex in routes | Not supported | Regex characters no longer work |
NestJS v11默认使用Express v5,路由匹配规则发生了变化:
| Express v4(旧版) | Express v5(新版) | 说明 |
|---|---|---|
| | 通配符必须命名 |
| | 大括号表示路径可选(匹配根路径) |
| 不支持 | 请改用大括号 |
| 路由中的正则表达式 | 不支持 | 正则表达式字符不再生效 |
CacheModule Migration to Keyv
CacheModule 迁移至Keyv
The now uses Keyv adapters instead of stores:
CacheModulecache-managertypescript
// OLD (pre-v11) — no longer works
CacheModule.register({ store: redisStore, host: 'localhost', port: 6379 });
// NEW (v11+) — uses @keyv/redis
import { KeyvRedis } from '@keyv/redis';
CacheModule.registerAsync({
useFactory: async () => ({
stores: [new KeyvRedis('redis://localhost:6379')],
}),
});CacheModulecache-managertypescript
// 旧版(v11之前)—— 不再生效
CacheModule.register({ store: redisStore, host: 'localhost', port: 6379 });
// 新版(v11+)—— 使用@keyv/redis
import { KeyvRedis } from '@keyv/redis';
CacheModule.registerAsync({
useFactory: async () => ({
stores: [new KeyvRedis('redis://localhost:6379')],
}),
});Production Best Practices
生产环境最佳实践
Bootstrap & Application Setup
启动与应用配置
Configure globally in — this is a security-critical step:
ValidationPipemain.tstypescript
app.useGlobalPipes(new ValidationPipe({
whitelist: true, // strips unknown properties
forbidNonWhitelisted: true, // rejects requests with unknown properties (400)
transform: true, // enables automatic type coercion for params
}));在中全局配置——这是一项安全性关键步骤:
main.tsValidationPipetypescript
app.useGlobalPipes(new ValidationPipe({
whitelist: true, // 移除未知属性
forbidNonWhitelisted: true, // 拒绝包含未知属性的请求(返回400)
transform: true, // 启用参数自动类型转换
}));Entity & Schema Discipline
实体与Schema规范
- Use explicit column lengths: , not bare
@Column({ length: 255 })@Column() - Name tables explicitly: to avoid surprises with naming conventions
@Entity('books') - Use and
@CreateDateColumn()for automatic timestamps@UpdateDateColumn() - Use specialized validators like ,
@IsISBN(),@IsEmail()— not just@IsUUID()@IsString() - Align nullability between entity and DTO: if , the DTO field should be
@Column({ nullable: true })@IsOptional()
- 使用明确的列长度:,而非直接使用
@Column({ length: 255 })@Column() - 显式指定表名:,避免命名约定带来的意外问题
@Entity('books') - 使用和
@CreateDateColumn()自动生成时间戳@UpdateDateColumn() - 使用专用验证器如、
@IsISBN()、@IsEmail()——而非仅使用@IsUUID()@IsString() - 保持实体与DTO的可空性一致:如果实体字段为,则DTO中对应字段应标记为
@Column({ nullable: true })@IsOptional()
DTO Patterns
DTO 实现模式
- Import from
PartialType(not@nestjs/swagger) when using Swagger — this preserves API documentation metadata on partial fields@nestjs/mapped-types - Zod validation is now an officially supported alternative to — use
class-validatorwithZodValidationPipefor schema-first validation with type inferencez.infer<typeof schema>
- 当使用Swagger时,从导入
@nestjs/swagger(而非PartialType)——这会保留部分字段的API文档元数据@nestjs/mapped-types - Zod验证现已成为的官方替代方案——结合
class-validator与ZodValidationPipe实现基于Schema的验证,并支持类型推断z.infer<typeof schema>
Guards & Auth
守卫与认证
NestJS v11 documents two auth approaches:
- Native JWT (recommended for simpler cases): Use directly with a custom
@nestjs/jwtguard that callsCanActivate. No Passport dependency needed.JwtService.verifyAsync() - Passport-based (for complex strategies like OAuth2, SAML): Use with
@nestjs/passport. Now documented under "recipes" rather than primary auth docs.PassportStrategy
Regardless of approach:
- Guard ordering matters: — JWT guard must run first to populate
@UseGuards(JwtAuthGuard, RolesGuard)before RolesGuard reads itrequest.user - Use (not just
Reflector.getAllAndOverride()) so roles can be set at both handler and class level with handler taking precedence.get() - RolesGuard must throw with a descriptive message when the user lacks the required role — do NOT just return
ForbiddenExceptionfromfalse. The generic 403 provides no diagnostic value. Include context:canActivate()Requires roles: ${requiredRoles.join(', ')}`)`throw new ForbiddenException(\ - Never hardcode JWT secrets — use with
JwtModule.registerAsync()ConfigService - Define a enum rather than raw strings for type safety
Role - In (or native guard), validate the presence of required payload fields (
JwtStrategy.validate(),sub,username) before returning the user object. Define arolesinterface for type safety.JwtPayload
NestJS v11文档中介绍了两种认证方式:
- 原生JWT(推荐用于简单场景):直接使用,配合自定义
@nestjs/jwt守卫调用CanActivate。无需依赖Passport。JwtService.verifyAsync() - 基于Passport(适用于OAuth2、SAML等复杂策略):使用与
@nestjs/passport。该方式现在被归类到“实践方案”而非核心认证文档中。PassportStrategy
无论采用哪种方式:
- 守卫的执行顺序至关重要:——JWT守卫必须先执行,在RolesGuard读取
@UseGuards(JwtAuthGuard, RolesGuard)之前完成用户信息填充request.user - 使用(而非仅使用
Reflector.getAllAndOverride()),这样可以在处理器和类级别同时设置角色,且处理器级别的设置优先级更高.get() - 当用户缺少所需角色时,RolesGuard必须抛出带有描述性信息的——不要仅从
ForbiddenException返回canActivate()。通用的403错误无法提供诊断价值,请包含上下文信息:false需要角色:${requiredRoles.join(', ')}`)`throw new ForbiddenException(\ - 切勿硬编码JWT密钥——使用配合
JwtModule.registerAsync()ConfigService - 定义枚举而非原始字符串以保证类型安全
Role - 在(或原生守卫)中,在返回用户对象之前,验证所需负载字段(
JwtStrategy.validate()、sub、username)是否存在。定义roles接口以保证类型安全。JwtPayload
Error Messages
错误信息
All thrown exceptions (, , , etc.) should include descriptive messages that identify what was expected, what was found, and what action the consumer should take. Do not rely on framework default messages in production code.
ForbiddenExceptionUnauthorizedExceptionNotFoundException所有抛出的异常(、、等)都应包含描述性信息,说明预期内容、实际情况以及用户应采取的操作。生产环境代码中不要依赖框架默认的错误信息。
ForbiddenExceptionUnauthorizedExceptionNotFoundExceptionMicroservices & Queues
微服务与队列
- For hybrid apps (HTTP + microservice), use +
NestFactory.create()patternapp.connectMicroservice() - Always call when using Terminus health checks for graceful shutdown
app.enableShutdownHooks() - Use (not
@nestjs/bullmq) — it wraps the newer@nestjs/bulllibrary. Config usesbullmqkey (notconnection):redistypescriptBullModule.forRoot({ connection: { host: 'localhost', port: 6379 } }) - Use with
BullModule.forRootAsync()injection for production configConfigService - BullMQ consumers extend and implement
WorkerHost— do NOT use theprocess()decorator (that's the older@Process()API)@nestjs/bull - Register and
@OnWorkerEvent('completed')lifecycle hooks for observability@OnWorkerEvent('failed') - Set and configure retry with
removeOnComplete: trueon jobsbackoff: { type: 'exponential' } - Capture and log from
job.idreturn value for traceabilityqueue.add() - Use for long-running jobs to enable monitoring dashboards
job.updateProgress() - Define and export TypeScript interfaces for all event payloads (e.g., ,
OrderCreatedEvent) for type safety across service boundariesUserRegisteredEvent
- 对于混合应用(HTTP + 微服务),使用+
NestFactory.create()模式app.connectMicroservice() - 使用Terminus健康检查时,请务必调用以实现优雅关闭
app.enableShutdownHooks() - 使用(而非
@nestjs/bullmq)——它封装了更新的@nestjs/bull库。配置时使用bullmq键(而非connection):redistypescriptBullModule.forRoot({ connection: { host: 'localhost', port: 6379 } }) - 使用并注入
BullModule.forRootAsync()以实现生产环境配置ConfigService - BullMQ消费者需继承并实现
WorkerHost——不要使用process()装饰器(这是旧版@Process()的API)@nestjs/bull - 注册和
@OnWorkerEvent('completed')生命周期钩子以实现可观测性@OnWorkerEvent('failed') - 为作业设置,并配置指数退避重试:
removeOnComplete: truebackoff: { type: 'exponential' } - 捕获并记录返回值中的
queue.add()以实现可追踪性job.id - 对于长时间运行的作业,使用以支持监控仪表盘
job.updateProgress() - 为所有事件负载定义并导出TypeScript接口(如、
OrderCreatedEvent),以保证跨服务边界的类型安全UserRegisteredEvent
Health Checks
健康检查
- Don't just check one thing — include multiple indicators: service connectivity (Redis/DB), memory (heap + RSS), and disk usage
- Use for transport checks,
MicroserviceHealthIndicatorfor heap/RSS,MemoryHealthIndicatorfor storageDiskHealthIndicator - Configure graceful shutdown timeout:
TerminusModule.forRoot({ gracefulShutdownTimeoutMs: 1000 })
- 不要仅检查单一指标——应包含多个检查项:服务连通性(Redis/数据库)、内存(堆内存+RSS)、磁盘使用情况
- 使用检查传输层状态,
MicroserviceHealthIndicator检查堆内存/RSS,MemoryHealthIndicator检查存储状态DiskHealthIndicator - 配置优雅关闭超时:
TerminusModule.forRoot({ gracefulShutdownTimeoutMs: 1000 })
OpenAPI / Swagger
OpenAPI / Swagger
The CLI plugin can eliminate most manual annotations. Add to :
@nestjs/swagger@ApiProperty()nest-cli.jsonjson
{
"compilerOptions": {
"plugins": [{
"name": "@nestjs/swagger",
"options": { "classValidatorShim": true, "introspectComments": true }
}]
}
}With the plugin enabled, TypeScript types, default values, optional markers, and JSDoc comments are automatically inferred — you only need explicit for edge cases.
@ApiProperty()@nestjs/swagger@ApiProperty()nest-cli.jsonjson
{
"compilerOptions": {
"plugins": [{
"name": "@nestjs/swagger",
"options": { "classValidatorShim": true, "introspectComments": true }
}]
}
}启用插件后,TypeScript类型、默认值、可选标记和JSDoc注释会被自动推断——仅在特殊场景下才需要显式使用。
@ApiProperty()Testing
测试
- is now a recommended testing library for NestJS:
@suites/unit- — all dependencies auto-mocked
TestBed.solitary(Service).compile() - — selected real deps
TestBed.sociable(Service).expose(RealDep).compile() - type for full IntelliSense on mock methods
Mocked<T> - Supports Jest, Vitest, and Sinon
- For e2e testing, use with
@nestjs/testingandTest.createTestingModule()supertest
- 现已成为NestJS推荐的测试库:
@suites/unit- —— 所有依赖自动被模拟
TestBed.solitary(Service).compile() - —— 选择部分真实依赖
TestBed.sociable(Service).expose(RealDep).compile() - 类型为模拟方法提供完整的智能提示
Mocked<T> - 支持Jest、Vitest和Sinon
- 对于端到端测试,使用配合
@nestjs/testing和Test.createTestingModule()supertest
Custom Decorators
自定义装饰器
- For NestJS 10+, prefer over
Reflector.createDecorator<Role[]>()for custom decorators — it provides better type inference and eliminates the need for a separate metadata key constantSetMetadata - The pattern still works and is fine for simple cases
SetMetadata
- 对于NestJS 10+,优先使用而非
Reflector.createDecorator<Role[]>()来创建自定义装饰器——它提供了更好的类型推断,且无需单独的元数据键常量SetMetadata - 模式仍然有效,适用于简单场景
SetMetadata
CLI
CLI
| Topic | Description | Reference |
|---|---|---|
| CLI Overview | Scaffolding, building, and running applications | cli-overview |
| Monorepo & Libraries | Workspaces, apps, shared libraries | cli-monorepo |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| CLI 概述 | 脚手架、构建与运行应用 | cli-overview |
| 单体仓库与库 | 工作区、应用、共享库 | cli-monorepo |
Core References
核心模块参考
| Topic | Description | Reference |
|---|---|---|
| Controllers | Route handlers, HTTP methods, request/response handling | core-controllers |
| Modules | Application structure, feature modules, shared modules, dynamic modules | core-modules |
| Providers | Services, dependency injection, custom providers | core-providers |
| Dependency Injection | DI fundamentals, custom providers, scopes | core-dependency-injection |
| Middleware | Request/response middleware, functional middleware | core-middleware |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 控制器 | 路由处理器、HTTP方法、请求/响应处理 | core-controllers |
| 模块 | 应用结构、功能模块、共享模块、动态模块 | core-modules |
| 提供者 | 服务、依赖注入、自定义提供者 | core-providers |
| 依赖注入 | 依赖注入基础、自定义提供者、作用域 | core-dependency-injection |
| 中间件 | 请求/响应中间件、函数式中间件 | core-middleware |
Fundamentals
基础概念
| Topic | Description | Reference |
|---|---|---|
| Pipes | Data transformation and validation pipes | fundamentals-pipes |
| Guards | Authorization guards, role-based access control | fundamentals-guards |
| Interceptors | Aspect-oriented programming, response transformation | fundamentals-interceptors |
| Exception Filters | Error handling, custom exception filters | fundamentals-exception-filters |
| Custom Decorators | Creating custom parameter decorators | fundamentals-custom-decorators |
| Dynamic Modules | Configurable modules, module configuration | fundamentals-dynamic-modules |
| Execution Context | Accessing request context, metadata reflection | fundamentals-execution-context |
| Provider Scopes | Singleton, request-scoped, transient providers | fundamentals-provider-scopes |
| Lifecycle Events | Application and provider lifecycle hooks | fundamentals-lifecycle-events |
| Lazy Loading | Loading modules on-demand for serverless | fundamentals-lazy-loading |
| Circular Dependency | Resolving circular dependencies with forwardRef | fundamentals-circular-dependency |
| Module Reference | Accessing providers dynamically with ModuleRef | fundamentals-module-reference |
| Testing | Unit testing and e2e testing with @nestjs/testing | fundamentals-testing |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 管道 | 数据转换与验证管道 | fundamentals-pipes |
| 守卫 | 授权守卫、基于角色的访问控制 | fundamentals-guards |
| 拦截器 | 面向切面编程、响应转换 | fundamentals-interceptors |
| 异常过滤器 | 错误处理、自定义异常过滤器 | fundamentals-exception-filters |
| 自定义装饰器 | 创建自定义参数装饰器 | fundamentals-custom-decorators |
| 动态模块 | 可配置模块、模块配置 | fundamentals-dynamic-modules |
| 执行上下文 | 访问请求上下文、元数据反射 | fundamentals-execution-context |
| 提供者作用域 | 单例、请求作用域、临时提供者 | fundamentals-provider-scopes |
| 生命周期事件 | 应用与提供者生命周期钩子 | fundamentals-lifecycle-events |
| 懒加载 | 按需加载模块以适配无服务器架构 | fundamentals-lazy-loading |
| 循环依赖 | 使用forwardRef解决循环依赖 | fundamentals-circular-dependency |
| 模块引用 | 使用ModuleRef动态访问提供者 | fundamentals-module-reference |
| 测试 | 使用@nestjs/testing进行单元测试与端到端测试 | fundamentals-testing |
Techniques
技术实现
| Topic | Description | Reference |
|---|---|---|
| Validation | ValidationPipe, class-validator, Zod validation | techniques-validation |
| Configuration | Environment variables, ConfigModule, configuration management | techniques-configuration |
| Database | TypeORM, Prisma, MongoDB integration | techniques-database |
| Caching | Keyv-based cache manager, Redis integration | techniques-caching |
| Logging | Built-in logger, custom loggers, JSON logging | techniques-logging |
| File Upload | File upload handling with multer, validation | techniques-file-upload |
| Versioning | URI, header, and media type API versioning | techniques-versioning |
| Serialization | Response serialization with class-transformer | techniques-serialization |
| Queues | Background job processing with BullMQ | techniques-queues |
| Task Scheduling | Cron jobs, intervals, and timeouts | techniques-task-scheduling |
| Events | Event-driven architecture with EventEmitter | techniques-events |
| HTTP Module | Making HTTP requests with Axios | techniques-http-module |
| Fastify | Using Fastify for better performance | techniques-fastify |
| Sessions & Cookies | HTTP sessions and cookies for stateful apps | techniques-sessions-cookies |
| Streaming & SSE | Compression, file streaming, Server-Sent Events | techniques-compression-streaming-sse |
| MVC & Serve Static | Template rendering (Handlebars) and SPA static serving | techniques-mvc-serve-static |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 验证 | ValidationPipe、class-validator、Zod验证 | techniques-validation |
| 配置 | 环境变量、ConfigModule、配置管理 | techniques-configuration |
| 数据库 | TypeORM、Prisma、MongoDB集成 | techniques-database |
| 缓存 | 基于Keyv的缓存管理器、Redis集成 | techniques-caching |
| 日志 | 内置日志器、自定义日志器、JSON格式日志 | techniques-logging |
| 文件上传 | 使用multer处理文件上传、验证 | techniques-file-upload |
| 版本控制 | URI、请求头、媒体类型API版本控制 | techniques-versioning |
| 序列化 | 使用class-transformer进行响应序列化 | techniques-serialization |
| 队列 | 使用BullMQ处理后台作业 | techniques-queues |
| 任务调度 | Cron任务、定时任务与延迟任务 | techniques-task-scheduling |
| 事件 | 基于EventEmitter的事件驱动架构 | techniques-events |
| HTTP模块 | 使用Axios发送HTTP请求 | techniques-http-module |
| Fastify | 使用Fastify提升性能 | techniques-fastify |
| 会话与Cookie | 用于有状态应用的HTTP会话与Cookie | techniques-sessions-cookies |
| 流与SSE | 压缩、文件流、服务器发送事件 | techniques-compression-streaming-sse |
| MVC与静态资源服务 | 模板渲染(Handlebars)与SPA静态资源服务 | techniques-mvc-serve-static |
Security
安全
| Topic | Description | Reference |
|---|---|---|
| Authentication | Native JWT auth and Passport integration | recipes-authentication |
| Authorization | RBAC, claims-based, CASL integration | security-authorization |
| CORS & Rate Limiting | CORS, Helmet, ThrottlerModule | security-cors-helmet-rate-limiting |
| Encryption & Hashing | bcrypt, argon2, password hashing | security-encryption-hashing |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 身份验证 | 原生JWT认证与Passport集成 | recipes-authentication |
| 授权 | RBAC、基于声明的授权、CASL集成 | security-authorization |
| CORS与速率限制 | CORS、Helmet、ThrottlerModule | security-cors-helmet-rate-limiting |
| 加密与哈希 | bcrypt、argon2、密码哈希 | security-encryption-hashing |
OpenAPI
OpenAPI
| Topic | Description | Reference |
|---|---|---|
| Swagger | OpenAPI documentation generation, CLI plugin | openapi-swagger |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| Swagger | OpenAPI文档生成、CLI插件 | openapi-swagger |
WebSockets
WebSocket
| Topic | Description | Reference |
|---|---|---|
| Gateways | Real-time communication with Socket.IO/ws | websockets-gateways |
| Guards & Exception Filters | WsException, BaseWsExceptionFilter, interceptors, pipes | websockets-advanced |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 网关 | 使用Socket.IO/ws实现实时通信 | websockets-gateways |
| 守卫与异常过滤器 | WsException、BaseWsExceptionFilter、拦截器、管道 | websockets-advanced |
Microservices
微服务
| Topic | Description | Reference |
|---|---|---|
| Overview | Transport layers, message patterns, events | microservices-overview |
| gRPC | Protocol Buffers, streaming, metadata, reflection | microservices-grpc |
| Transports | Redis, Kafka, NATS, RabbitMQ configuration | microservices-transports |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 概述 | 传输层、消息模式、事件 | microservices-overview |
| gRPC | Protocol Buffers、流、元数据、反射 | microservices-grpc |
| 传输层 | Redis、Kafka、NATS、RabbitMQ配置 | microservices-transports |
GraphQL
GraphQL
| Topic | Description | Reference |
|---|---|---|
| Overview | Code-first and schema-first approaches | graphql-overview |
| Resolvers & Mutations | Queries, mutations, field resolvers | graphql-resolvers-mutations |
| Subscriptions | Real-time subscriptions with PubSub | graphql-subscriptions |
| Scalars, Unions & Enums | Interfaces, scalars, union types, enums | graphql-scalars-unions-enums |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 概述 | 代码优先与Schema优先方案 | graphql-overview |
| 解析器与变更 | 查询、变更、字段解析器 | graphql-resolvers-mutations |
| 订阅 | 使用PubSub实现实时订阅 | graphql-subscriptions |
| 标量、联合类型与枚举 | 接口、标量、联合类型、枚举 | graphql-scalars-unions-enums |
Recipes
实践方案
| Topic | Description | Reference |
|---|---|---|
| CRUD Generator | Nest CLI resource generator | recipes-crud-generator |
| Documentation | OpenAPI/Swagger integration | recipes-documentation |
| TypeORM | TypeORM integration and usage | recipes-typeorm |
| Prisma | Prisma ORM integration | recipes-prisma |
| Mongoose | MongoDB with Mongoose ODM | recipes-mongoose |
| CQRS | Command Query Responsibility Segregation | recipes-cqrs |
| Terminus | Health checks and readiness/liveness probes | recipes-terminus |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| CRUD生成器 | Nest CLI资源生成器 | recipes-crud-generator |
| 文档 | OpenAPI/Swagger集成 | recipes-documentation |
| TypeORM | TypeORM集成与使用 | recipes-typeorm |
| Prisma | Prisma ORM集成 | recipes-prisma |
| Mongoose | MongoDB与Mongoose ODM集成 | recipes-mongoose |
| CQRS | 命令查询职责分离 | recipes-cqrs |
| Terminus | 健康检查与就绪/存活探针 | recipes-terminus |
FAQ
常见问题
| Topic | Description | Reference |
|---|---|---|
| Raw Body & Hybrid | Webhook signature verification, HTTP + microservices | faq-raw-body-hybrid |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 原始请求体与混合应用 | Webhook签名验证、HTTP + 微服务 | faq-raw-body-hybrid |
Best Practices
最佳实践
| Topic | Description | Reference |
|---|---|---|
| Request Lifecycle | Understanding execution order and flow | best-practices-request-lifecycle |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 请求生命周期 | 理解执行顺序与流程 | best-practices-request-lifecycle |