NestJSInterview preparation
TECHNOLOGY INTERVIEW GUIDE

NestJS interview preparation.

Turn your understanding into examples, reasoning, and clear trade-offs.

PREPARE WITH ACTIVE RECALL

Explain before you reveal.

Choose a level, explore explained answers, then try a focused session.

Practice NestJS
Difficulty
Question type

18 questions

What are modules, controllers and services?

NestJS·Modules & dependency injection

Nest modules define feature boundaries and register the controllers and providers that belong to a feature. Controllers handle transport concerns, while services usually contain business rules. This separation makes code easier to reuse and test without tying every decision to HTTP.

Foundation2 min read

How does dependency injection work?

NestJS·Modules & dependency injection

Dependency injection means a class receives the objects it needs instead of constructing them itself. Nest's container uses registered provider tokens to build and connect these dependencies. This centralizes construction and lets tests or configuration replace an implementation without rewriting its consumers.

Foundation2 min read

Why does Nest say it cannot resolve a dependency?

NestJS·Modules & dependency injection

A dependency-resolution error means Nest cannot find or create a required provider in the current module context. The class may exist in source code but still be invisible to the consumer's module. Troubleshooting should follow the token, registration, export and import path.

Foundation2 min read

What are custom providers and provider scopes?

NestJS·Modules & dependency injection

A provider is a dependency that Nest can supply, such as a class instance, value or factory result. Custom providers control how that dependency is created, and scope controls how long its instances are shared. These choices affect testability, state isolation and allocation cost.

Foundation2 min read

Dynamic module vs global module?

NestJS·Modules & dependency injection

A dynamic module creates its module definition from supplied configuration, making a feature reusable in different environments. A global module makes its exported providers broadly available after registration. Dynamic describes configuration behavior; global describes visibility, so these are independent properties.

Foundation2 min read

What is the Nest request lifecycle?

NestJS·Request lifecycle

The request lifecycle is the order in which Nest processes an incoming request and produces a response. Different extension points handle different concerns, such as access checks, input conversion and response wrapping. Knowing the order helps explain why code in one stage cannot rely on work that happens later.

Intermediate2 min read

How do global, controller and route handlers interact?

NestJS·Request lifecycle

Nest can attach request handlers at global, controller and route scopes. Scope determines which requests a handler applies to, while handler type determines execution order. Interceptors wrap inner work and unwind on the response path; exception filters select a matching handler rather than form a normal middleware chain.

Intermediate2 min read

Guard vs pipe vs interceptor vs filter?

NestJS·Request lifecycle

Guards, pipes, interceptors and filters are separate request extension points with different jobs. A guard decides whether work may proceed; a pipe validates or transforms arguments; an interceptor wraps execution; a filter handles uncaught errors. Choosing the correct point avoids mixing authentication, validation and formatting into business methods.

Intermediate2 min read

Why use a DTO and ValidationPipe?

NestJS·Validation & authorization

A DTO describes the data a boundary accepts or returns, while ValidationPipe checks and optionally transforms incoming values at runtime. TypeScript types alone cannot validate a network payload because they are erased. Decorated DTO classes make the rules available to the validation mechanism.

Intermediate2 min read

How should authentication and permissions work?

NestJS·Validation & authorization

Authentication establishes who the caller is, and permissions determine which actions and records that caller may access. In Nest, guards commonly apply these checks before controller execution, often using Passport strategies for authentication. Resource-level checks still need enough context to enforce ownership and tenant rules.

Intermediate2 min read

TypeORM vs Sequelize vs Mongoose?

NestJS·Database integration

TypeORM and Sequelize are object-relational mappers for relational databases, while Mongoose models documents in MongoDB. They provide convenient data-access APIs but do not replace database knowledge. The generated queries, constraints and transaction behavior still determine correctness and performance.

Intermediate2 min read

Repository vs QueryBuilder vs raw SQL?

NestJS·Database integration

A repository exposes common operations around an entity, QueryBuilder assembles more flexible database queries, and raw SQL gives direct control over SQL text. These are levels of access rather than a ranking from bad to good. Use the simplest approach that expresses the required query clearly and efficiently.

Intermediate2 min read

How should a TypeORM transaction work?

NestJS·Database integration

A transaction groups database changes so they can commit together or roll back together. In TypeORM, the transaction callback receives a manager tied to that transaction's connection. Queries issued through an unrelated global repository may not participate, even if they appear inside the same JavaScript callback.

Intermediate2 min read

What are N+1, eager loading and lazy loading?

NestJS·Database integration

N+1 is a data-access pattern where fetching N parent records leads to roughly N more queries for related records. Eager loading fetches configured relations up front, while lazy loading waits until the relation is accessed. Both loading styles can waste work if they do not match the endpoint's real needs.

Intermediate2 min read

Why use migrations instead of automatic schema sync?

NestJS·Database integration

A migration is a versioned database change that can be reviewed and applied deliberately. Automatic schema synchronization tries to match the schema to entity definitions and may make changes without a safe production rollout plan. Migrations make data changes, compatibility and deployment order explicit.

Intermediate2 min read

Difficulty is editorial guidance. These questions are not a ranking of interview frequency.

All NestJS interview questions by concept

Use the filters above for a practice selection, or follow the full question directory below. Each answer includes its source and explanation; difficulty labels are editorial guidance.

Prerequisites
Related to NestJS
Expand your skills next