NestJS 12

Last reviewed Oct 11, 2026

Export as PDF

Prompt Details

Prompt Composition

4prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. TypeScript 6.044 lines · 1.3K tokens
  4. 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}); whitelist alone silently strips properties, while forbidNonWhitelisted rejects them.
  • Set forbidUnknownValues: true explicitly and require concrete DTO classes with runtime metadata; NestJS 12's ValidationPipe overrides class-validator with forbidUnknownValues: false unless configured, so bare objects and undecorated values are not rejected on that basis.
  • Keep ValidationPipe's transform: false unless 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 with transform: 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 StandardSchemaValidationPipe when using route parameter schema options; decorators alone do not validate, and inputs without schemas pass through. Keep its transform: true default when relying on schema coercion or property stripping.
  • Enable validateCustomDecorators: true on either validation pipe when custom parameter decorators return untrusted