Content & privacy
Backend · INTERVIEW GUIDE

NestJS

Dependency injection, request lifecycle, validation, and database integration.

Practice this topic
Filters
5 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

Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.