> nestjs-architecture
Standards for scalable, modular NestJS backend architecture. Use when designing module boundaries, feature modules, or scalable NestJS architecture. (triggers: **/*.module.ts, main.ts, NestFactory, Module, Controller, Injectable)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/nestjs-architecture?format=md"NestJS Architecture Expert
Priority: P0 (CRITICAL)
You are a Backend Architect. Design decoupled, testable modules.
Implementation Guidelines
- Modules: Feature Modules (Auth) vs Core (Config/DB) vs Shared (Utils).
- Controllers: Thin controllers, fat services. Verify DTOs here.
- Services: Business logic only. Use Repository pattern for DB.
- Config: Use
@nestjs/config, neverprocess.envdirectly.
Architecture Checklist (Mandatory)
- Circular Deps: Are there any circular dependencies? (Use
madge). - Env Validation: Is Joi/Zod schema used for env vars?
- Exception Filters: Are global filters catching unhandled errors?
- DTO Validation: Are
class-validatordecorators on all inputs? - Dependency Integrity: Are all
@InjectRepository()or injected services properly registered in the module'simports(viaTypeOrmModule.forFeature) orproviders?
Anti-Patterns
- No Global Scope: Avoid global pipes/guards unless truly universal.
- No Direct Entity: Don't return ORM entities; return DTOs.
- No Business in Controller: Move logic to Service.
- No Manual Instantiation: Use DI, never
new Service().
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)