NestJS Cheat Sheet 2026

The 30 highest-yield NestJS facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

60 questions
75 min time limit
70.00% to pass
  1. How do you make a NestJS module available globally without importing it in every other module? Add @Global() decorator to the module class
  2. What does enabling `strict mode` in NestJS's ValidationPipe do? Throws on any unrecognized property in the request body
  3. Which built-in NestJS pipe validates and strips non-whitelisted properties from a DTO? ValidationPipe
  4. What are the capabilities of a module described as? A collection of closely related capabilities
  5. How do you apply a pipe globally to all routes in NestJS? Use app.useGlobalPipes() in main.ts
  6. Based on evidence from NestJS documentation, which Jest configuration option is set in jest.config.js to map TypeScript path aliases in test files? moduleNameMapper
  7. A NestJS app's database queries slow down due to N+1 problems in a TypeORM relation. What resolves this without a full ORM rewrite? Use QueryBuilder with explicit leftJoinAndSelect to load relations in a single query
  8. A NestJS app stores user sessions in memory. What availability risk does this introduce in a horizontally scaled deployment? Sessions are node-local, so users hitting different instances lose their session state
  9. In NestJS, what is the purpose of the ConfigModule? To load and expose environment variables application-wide
  10. What is the purpose of the @nestjs/testing package's `overrideGuard` method? To replace a guard with a custom test-only implementation
  11. Which built-in NestJS module provides configuration management and environment variables? @nestjs/config
  12. Which decorator is used to define a NestJS middleware class? @Injectable()
  13. Which file is the entry point of a NestJS application created by the CLI? main.ts
  14. Which built-in NestJS pipe validates and transforms incoming request data against a DTO class? ValidationPipe
  15. When analyzing NestJS OpenAPI documentation practices, which decorator applied to a DTO property describes it in the generated Swagger UI? @ApiProperty()
  16. What is the importance of data security in NestJS digital applications? Protecting sensitive information from unauthorized access, breaches, and loss is essential
  17. How do you make a single route publicly accessible when JWT auth is applied globally in NestJS? Use a custom @Public() decorator combined with a reflector check in the guard
  18. Which interface must a NestJS Guard implement? CanActivate
  19. Which database strategy is recommended for NestJS integration tests that need a real database connection without polluting production data? Using an in-memory SQLite instance or a dedicated test database
  20. What does NestJS support? GraphQL and WebSockets
  21. When writing an E2E test with Supertest in NestJS, which method initializes the application before the test suite runs? app.init()
  22. Which decorator in @nestjs/swagger marks a DTO property as required in the generated API schema? @ApiProperty({ required: true })
  23. What does the @Query() decorator extract from a request? Query string parameters (?key=value)
  24. A DevOps stakeholder asks how to health-check the NestJS service. Which package provides a ready-made /health endpoint? @nestjs/terminus
  25. Which method must be called after `Test.createTestingModule()` to finalize the module for use in tests? .compile()
  26. What is the role of the `AppModule` in a NestJS application? It serves as the root module that bootstraps the entire application
  27. What is the purpose of ClientProxy in NestJS microservices? To send messages and emit events to a microservice from a client application
  28. What is the purpose of Guards in NestJS? To determine whether a request should be handled by the route handler (authorization)
  29. Which NestJS health-check library integrates with @nestjs/terminus to verify database connectivity as part of a readiness probe? TypeOrmHealthIndicator from @nestjs/terminus
  30. A NestJS application processes file uploads. What risk is introduced if uploaded file types and sizes are not validated? Attackers can upload malicious executables or exhaust disk/memory with oversized files
Was this helpful?