nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

NestJS/Guards

Decide whether a request is allowed to reach your controller before the actual business logic runs.

15 QuestionsAdvancedHigh Priority ~10 min read

Guards are designed to decide whether a request should continue through the NestJS request pipeline. They are commonly used for authentication and authorization, such as checking whether a user is logged in or has permission to access a resource.

Guards can access information about the current execution context, including the incoming request and the route being accessed. This makes them a good fit for decisions about whether a request should be allowed to proceed.

What you'll walk away knowing

What guards are responsible for
How CanActivate works
How guards are used for authentication and authorization
How guards differ from middleware
1How do you implement role-based access control (RBAC) with a guard and Reflector in NestJS?Advanced2How does the request lifecycle behave differently for WebSocket gateways vs HTTP controllers in NestJS?Intermediate3How do you implement a @Public() decorator to skip a global auth guard for specific routes in NestJS?Intermediate4What does a guard return when it needs to deny the request and how can it throw a custom exception in NestJS?Intermediate5How do you write a single guard that works across both HTTP and WebSocket transports in NestJS?Intermediate6What is a guard in NestJS and when should you use one over middleware?Intermediate
All Topics
1
Basics
Modules
Controllers
Dependency Injection
Providers
2
Request Lifecycle
Middleware
Guards
Interceptors
Pipes
Filters
Exception Handling
3
Decorators
Architecture
API Design
4
GraphQL
Database and ORM
Microservices
5
Authentication and Authorization
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.