nextjs-nestjs-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Next.js NestJS Integration

Next.js NestJS 集成

Use this skill when a project has both a Next.js app and a NestJS API. The main job is to keep ownership boundaries clear so the web app does not accidentally duplicate backend policy, bypass API contracts, or self-fetch at build time.
当项目同时包含 Next.js 应用和 NestJS API 时,使用此 skill。核心任务是保持职责边界清晰,避免 Web 应用意外复制后端策略、绕过 API 契约,或在构建时自请求。

When to Apply

适用场景

Use this skill when:
  • Generating or consuming typed clients from a NestJS OpenAPI document
  • Deciding whether logic belongs in Next.js Route Handlers/Server Actions or NestJS controllers/services
  • Propagating auth/session context from Next.js to NestJS
  • Configuring CORS, cookies, Proxy, rewrites, or internal API origins
  • Fetching NestJS data from Server Components without calling the Next.js app's own Route Handlers
  • Aligning Docker, environment variables, health checks, and deployment topology across apps
在以下情况下使用此 skill:
  • 从 NestJS OpenAPI 文档生成或使用类型化客户端
  • 判断逻辑应归属于 Next.js Route Handlers/Server Actions,还是 NestJS controllers/services
  • 从 Next.js 向 NestJS 传播认证/Session 上下文
  • 配置 CORS、Cookie、Proxy、rewrites 或内部 API origins
  • 从 Server Components 获取 NestJS 数据,而不调用 Next.js 应用自身的 Route Handlers
  • 对齐两个应用的 Docker、环境变量、健康检查和部署拓扑

Load On Demand

按需加载

Start with this file. Load detailed files only when the task needs them:
references/_sections.md
references/integration-openapi-client-boundary.md
references/integration-session-propagation.md
references/integration-cors-proxy-contract.md
references/integration-server-component-fetching.md
references/integration-shared-env-contract.md
references/integration-deployment-split.md
dataset/integration/openapi-client-boundary/correct.ts
sources/inventory.json
Each rule file includes:
  • Why the pattern matters
  • Incorrect and correct examples
  • Dataset path with larger TypeScript examples
  • Official source references
先从此文件开始。仅在任务需要时加载详细文件:
references/_sections.md
references/integration-openapi-client-boundary.md
references/integration-session-propagation.md
references/integration-cors-proxy-contract.md
references/integration-server-component-fetching.md
references/integration-shared-env-contract.md
references/integration-deployment-split.md
dataset/integration/openapi-client-boundary/correct.ts
sources/inventory.json
每个规则文件包括:
  • 该模式为何重要
  • 错误与正确示例
  • 包含更大型 TypeScript 示例的数据集路径
  • 官方来源引用

Rule Categories by Priority

按优先级划分的规则类别

PriorityCategoryImpactPrefix
1Integration BoundariesCRITICAL
integration-
2API ContractsCRITICAL
api-
3Deployment & OperationsHIGH
deploy-
优先级类别影响前缀
1集成边界严重
integration-
2API 契约严重
api-
3部署与运维高
deploy-

Source Policy

来源策略

Use this skill together with
nextjs-secure-bff
,
nextjs-production-platform
, and
nestjs-production-api-contracts
when the work spans both apps. Official Next.js and NestJS docs outrank framework-agnostic monorepo examples.
当工作横跨两个应用时,将此 skill 与
nextjs-secure-bff
、
nextjs-production-platform
和
nestjs-production-api-contracts
一起使用。官方 Next.js 和 NestJS 文档的优先级高于与框架无关的 monorepo 示例。