NestJS 11

Last reviewed Sep 6, 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 5.940 lines · 1.2K tokens
  4. 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}); whitelist alone silently strips properties, while forbidNonWhitelisted rejects them.
  • Set forbidUnknownValues: true explicitly and require concrete DTO classes with runtime metadata; NestJS 11's ValidationPipe overrides class-validator with forbidUnknownValues: false unless configured, and skips String, Boolean, Number, Array, and Object metatypes regardless.
  • Keep transform: false unless returned DTO instances and path/query primitive coercion are required; DTO validation still calls plainToInstance() internally, so keep DTO constructors and transforms free of side effects.
  • Set validateCustomDecorators: true when custom parameter decorators supply untrusted DTOs; ValidationPipe otherwise 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.