NestJS Interview Questions

Check out 30 of the most common NestJS interview questions and take an AI-powered practice interview

TypeScriptNode.jsDecoratorsMicroservicesGraphQL
30+
Questions
12
Basic
13
Intermediate
5
Advanced
Q1

What is NestJS and what problem does it solve?

BasicFundamentals
+
Q2

What are modules, controllers and providers in NestJS?

BasicArchitecture
+
Q3

How does dependency injection work in NestJS?

BasicDependency Injection
+
Q4

How do you handle route parameters, query strings and request bodies?

BasicRouting
+
Q5

What is a DTO and how does class-validator integrate with NestJS?

BasicValidation
+
Q6

What is the difference between @Controller and @Injectable?

BasicDecorators
+
Q7

How do you generate a new NestJS project and module?

BasicTooling
+
Q8

What are pipes in NestJS and what are they used for?

BasicPipes
+
Q9

How do you handle errors and return correct status codes?

BasicError Handling
+
Q10

How do you configure environment variables in a Nest app?

BasicConfiguration
+
Q11

How do you enable CORS in a NestJS application?

BasicSecurity
+
Q12

How does NestJS compare with plain Express in 2026?

BasicFundamentals
+
Q13

What are guards and how are they different from middleware?

IntermediateAuthorization
+
Q14

What is an interceptor and when should you use one?

IntermediateInterceptors
+
Q15

Exception filters vs error-handling interceptors — what is the difference?

IntermediateError Handling
+
Q16

What are the injection scopes in NestJS and when do you use REQUEST scope?

IntermediateDependency Injection
+
Q17

How do you handle circular dependencies between modules or providers?

IntermediateDependency Injection
+
Q18

How do you write unit tests for a NestJS service with mocked providers?

IntermediateTesting
+
Q19

How do you write end-to-end tests with Supertest in NestJS?

IntermediateTesting
+
Q20

How do you implement microservices with NestJS over TCP, Redis, RabbitMQ or Kafka?

IntermediateMicroservices
+
Q21

What are hybrid applications in NestJS?

IntermediateMicroservices
+
Q22

How do you build a GraphQL API with NestJS using the code-first approach?

IntermediateGraphQL
+
Q23

Code-first vs schema-first GraphQL in NestJS — which should you pick?

IntermediateGraphQL
+
Q24

How do you integrate TypeORM or Prisma with NestJS?

IntermediateDatabase
+
Q25

How do you compare NestJS with Spring Boot for backend development?

IntermediateComparison
+
Q26

How do you implement the CQRS pattern in NestJS?

AdvancedArchitecture
+
Q27

How do you build a custom decorator (including parameter decorators)?

AdvancedDecorators
+
Q28

What are dynamic modules and when do you need them?

AdvancedModules
+
Q29

How do you instrument a NestJS app with OpenTelemetry for distributed tracing?

AdvancedObservability
+
Q30

How would you architect a NestJS backend for 10,000+ requests per second?

AdvancedArchitecture
+

Companies Hiring NestJS

Adidas
Roche
GitLab
Decathlon
Razorpay
Swiggy
Zerodha

Salary Insights

Average in India
₹8-25 LPA

Frequently Asked Questions

Is NestJS better than plain Express in 2026?

For non-trivial APIs, almost always yes. NestJS gives you dependency injection, modular structure, validation, guards, interceptors, microservice transports, and GraphQL out of the box — features you would otherwise bolt onto Express piecemeal with disparate libraries that do not agree on conventions. Plain Express is still a good choice for very small services or single-file webhooks where the structure would be overhead, but for anything intended to live in production for more than a quarter the NestJS investment pays off quickly.

How much does a NestJS developer earn in India?

Around ₹8-25 LPA in 2026 for mid-to-senior backend developers with NestJS as their primary stack. Razorpay, Swiggy, Zerodha, CRED, Postman, and global SaaS teams hiring out of India (GitLab, Adidas, Roche) pay at the upper end, especially for engineers comfortable with microservices, GraphQL, CQRS, and observability. Engineers who also know infrastructure (Kubernetes, Terraform, distributed tracing) can push past that range for staff-level roles.

Should I learn Angular before NestJS?

No, but the experience helps. NestJS borrows modules, decorators, and dependency injection from Angular, so Angular developers feel at home immediately. You do not need to know Angular to learn NestJS — solid TypeScript and an understanding of constructor-based dependency injection are enough. Many NestJS engineers in India come from a React background and learn the framework in two to three weeks without ever writing Angular code.

How does NestJS compare with Spring Boot for enterprise backends?

Conceptually very similar — both are opinionated, DI-driven frameworks with strong type systems, decorators or annotations, and unified support for REST, GraphQL, and messaging. The choice usually comes down to language and ecosystem: Spring Boot if your team is Java or Kotlin and CPU-heavy workloads dominate; NestJS if you want a TypeScript end-to-end stack, faster iteration on I/O-bound APIs, and shared tooling between backend and frontend engineers.

When should I use Fastify instead of Express in NestJS?

Switch to FastifyAdapter when you are serving high-throughput JSON APIs and want 15-30% more requests per second on the same hardware. The main trade-off is the Express ecosystem — some Express middleware does not work transparently and you may need Fastify-native plugins. For lower-traffic apps the default Express adapter is fine, and migrating later is a small refactor confined to main.ts and any custom middleware.

Is NestJS production-ready for fintech and payment platforms?

Yes, and it is widely used for exactly that. Indian fintech players like Razorpay, Zerodha, and CRED run NestJS in production for serious workloads including payment orchestration, fraud detection, and ledger services. The framework's structured DI and explicit interfaces make audit, testing, and compliance easier than ad-hoc Express services, which is exactly what regulated industries need. Pair it with Postgres for the core ledger, Kafka for event distribution, and OpenTelemetry for end-to-end traceability and you have an architecture that survives RBI audits.

Introduction

NestJS has firmly established itself as the default enterprise framework for Node.js in 2026. Built on top of Express (or optionally Fastify) and inspired heavily by Angular, it brings dependency injection, modular architecture, decorators, and strong TypeScript typing to a runtime that historically suffered from spaghetti Express code. Teams that previously used Spring Boot in Java or .NET Core in C# tend to feel immediately at home, while frontend engineers who have shipped Angular applications find the mental model so familiar that they can move into backend work with very little ramp time.

If you are interviewing for a NestJS role in India today, expect deep questions on modules and providers, dependency injection scopes, exception filters versus interceptors, microservice transports (TCP, Redis, RabbitMQ, Kafka), GraphQL with code-first schemas, and testing patterns using Jest with mocked providers. Indian fintech companies like Razorpay, Zerodha and CRED, along with global SaaS players like GitLab and Adidas, rely on NestJS for serious production backends — interviewers at those companies push hard on architecture, observability, and how you handle real production failure modes.

This guide walks through the 30 most-asked NestJS interview questions in 2026, grouped by difficulty. Each answer includes the underlying concept, common production gotchas, and a TypeScript code example where it adds clarity. Read the basic section to consolidate fundamentals, then push into the intermediate and advanced sections for the topics that actually decide senior offers — CQRS, custom decorators, dynamic modules, OpenTelemetry tracing, and scaling beyond ten thousand requests per second.