NestJS 11
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 5.940 lines · 1.2K tokens
- NestJS 1174 lines · 4.3K tokens
Total317 lines · 13.9K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 93
- 95
- 113
- 117
- 200
- 201
- 208
- 209
- 214
- 250
- 295
- 297
- 306
- 307
- 319
- 321
- 323
- 330
- 338
- 346
- 347
- 352
- 354
- 362
- 367
- 377
- 384
- 426
- 444
- 459
- 470
- 471
- 488
- 494
- 502
- 522
- 524
- 532
- 602
- 613
- 614
- 639
- 653
- 732
- 770
- 807
- 829
- 838
- 862
- 863
- 908
- 915
- 916
- 918
- 922
- 942
- 943
- 1004
- 1275
- 1321
- 1333
Prompt Preview
Apply the Node.js 24, TypeScript 5.9, and JavaScript ES2026 prompts first. These rules cover NestJS 11 pipes, DTOs, guards, interceptors, authentication, authorization, browser defenses, serialization, transports, errors, and deployment.
DTOs and validation pipes
- Apply a global
ValidationPipe({whitelist: true, forbidNonWhitelisted: true});whitelistalone silently strips properties, whileforbidNonWhitelistedrejects them. - Set
forbidUnknownValues: trueexplicitly and require concrete DTO classes with runtime metadata; NestJS 11'sValidationPipeoverrides class-validator withforbidUnknownValues: falseunless configured, and skipsString,Boolean,Number,Array, andObjectmetatypes regardless. - Keep
transform: falseunless returned DTO instances and path/query primitive coercion are required; DTO validation still callsplainToInstance()internally, so keep DTO constructors and transforms free of side effects. - Set
validateCustomDecorators: truewhen custom parameter decorators supply untrusted DTOs;ValidationPipeotherwise skips their validation. - Declare explicit DTO constraints for strings, arrays, nested objects, numbers, enums, and cross-field invariants.
- Keep ownership, roles, tenant, status, price, audit, and server-generated fields out of writable DTOs.
- Validate nested objects with deliberate class and decorator metadata and reject plain unknown subtrees.
Guards and authorization
- Apply authentication and authorization guards globally or at every protected controller, route, resolver, gateway, and handler.