Nestjs architecture

From HoangNguyen0403/agent-skills-standard · View interactive version

Nestjs architecture is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Design NestJS module boundaries and provider ownership. Use only when structuring feature/core/shared modules, controller-service boundaries, or provider lifetime; defer JWT/security, caching, and unrelated request-pipeline recipes.

How to use this skill

Skill file

NestJS Architecture Expert

**Priority: P0 (CRITICAL)**

Design feature modules with singleton-first providers and explicit request-pipeline choices.

Decision Map

Recipe

  1. Create bounded feature: module + controller + application service + persistence adapter.
  2. Keep controller thin: Thin controllers, fat services. No business in Controller. Move logic to Service.
  3. Register dependencies once: imports for modules, providers for services, exports only for true consumers. @InjectRepository() dependencies need TypeOrmModule.forFeature([...]).
  4. Validate at edges: DTO validation pipes for incoming data; never trust raw payloads in services.
  5. Check circular imports: check circular dependencies with madge; refactor contracts first and use forwardRef() only as last resort.

Verify

Anti-Patterns

References

Module-boundary checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.