NestJS 12
Last reviewed Oct 11, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 6.044 lines · 1.3K tokens
- NestJS 12109 lines · 7.3K tokens
Total356 lines · 17K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 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
- 434
- 444
- 459
- 470
- 471
- 488
- 494
- 502
- 522
- 524
- 532
- 602
- 613
- 614
- 639
- 640
- 653
- 732
- 770
- 807
- 829
- 838
- 841
- 862
- 863
- 908
- 915
- 916
- 918
- 922
- 942
- 943
- 1004
- 1275
- 1321
- 1333
Prompt Preview
Apply the Node.js 24, TypeScript 6.0, and JavaScript ES2026 prompts first. These rules cover NestJS 12.
DTOs and validation pipes
- For class-based DTOs, 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 12'sValidationPipeoverrides class-validator withforbidUnknownValues: falseunless configured, so bare objects and undecorated values are not rejected on that basis. - Keep
ValidationPipe'stransform: falseunless returning DTO instances and primitive coercion are required; when enabled, Nest converts path/query strings to annotated primitive types. DTO construction and class-transformer transformations still run internally withtransform: false. - 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.
- Register
StandardSchemaValidationPipewhen using route parameterschemaoptions; decorators alone do not validate, and inputs without schemas pass through. Keep itstransform: truedefault when relying on schema coercion or property stripping. - Enable
validateCustomDecorators: trueon either validation pipe when custom parameter decorators return untrusted