← ClaudeAtlas

nestjs-expertlisted

NestJS architecture, modules, DI, guards, interceptors, pipes, MongoDB/Mongoose integration, auth, and production patterns. Use when building NestJS APIs, designing module structure, implementing auth, handling errors, writing DTOs, or debugging NestJS-specific issues.
shipshitdev/skills · ★ 26 · API & Backend · score 76
Install: claude install-skill shipshitdev/skills
# NestJS Expert Production NestJS patterns for TypeScript APIs. Stack: NestJS + MongoDB/Mongoose + TypeScript strict mode. ## Module architecture Every feature is a self-contained module. No cross-module direct imports — use exported providers. ``` src/ ├── app.module.ts # Root — imports feature modules only ├── common/ # Shared guards, pipes, filters, interceptors │ ├── filters/ │ ├── guards/ │ ├── interceptors/ │ └── pipes/ ├── config/ # ConfigModule setup └── {feature}/ ├── {feature}.module.ts ├── {feature}.controller.ts ├── {feature}.service.ts ├── {feature}.repository.ts # optional, wraps Mongoose model ├── dto/ │ ├── create-{feature}.dto.ts │ └── update-{feature}.dto.ts ├── schemas/ │ └── {feature}.schema.ts └── {feature}.types.ts ``` ## Dependency injection rules - Inject interfaces, not concrete classes where possible - Use `@Injectable({ scope: Scope.DEFAULT })` (singleton) unless you need request-scoped - Circular deps = architectural problem — fix with `forwardRef` only as last resort - Test with `Test.createTestingModule` — always mock external services ## Controllers ```typescript @Controller('resources') @UseGuards(JwtAuthGuard) @UseInterceptors(ResponseTransformInterceptor) export class ResourceController { constructor(private readonly resourceService: ResourceService) {} @Get() async findAll(@Query() query: PaginationQueryDto) { return this.resou