NestJS introduces a rich vocabulary around its module system and dependency injection. Understanding these terms precisely is essential when discussing architecture, reviewing PRs, or interviewing for backend roles.
0 / 5 completed
1 / 5
A senior engineer says: 'This service has no DI container.' What does DI stand for in NestJS context?
DI stands for Dependency Injection — a design pattern where a class receives its dependencies from an external source rather than creating them itself. NestJS uses a built-in DI container to manage providers. The phrase 'no DI container' means the service is manually instantiating its dependencies, which makes testing harder and violates the inversion of control principle.
2 / 5
A junior dev asks: 'What does @Injectable()decorate in NestJS?' Which explanation is most accurate?
Decorators in TypeScript (and NestJS) are special annotations that add metadata to a class or method. @Injectable() specifically marks a class as a NestJS provider — meaning the framework's IoC (Inversion of Control) container can instantiate it and inject it wherever needed. Without it, a class cannot be injected as a dependency.
3 / 5
In a PR review, a comment says: 'Extract this into a provider.' What is a provider in NestJS?
In NestJS, a provider is any class decorated with @Injectable() (services, repositories, factories, helpers). The term comes from the Angular ecosystem. Providers are registered in a module and injected via the constructor. When someone says 'extract into a provider,' they mean make it a separate injectable class rather than inlining the logic.
4 / 5
A team lead says: 'Scope this provider as REQUEST-scoped, not singleton.' What does singleton scope mean?
Singleton scope means one instance is created when the application starts and reused for every request. This is NestJS's default. REQUEST scope creates a fresh instance per HTTP request — useful for per-request context (user data, tracing). Understanding scopes is important when discussing stateful services in architecture reviews.
5 / 5
A developer says: 'The module needs to export that service so other modules can use it.' What does exporting a provider mean in NestJS?
In NestJS, each module has its own scope. By default, providers are private to their module. To allow other modules to inject a provider, you must add it to the module's exports array. This is called exporting a provider. In design discussions, you'll hear: 'Does UserModule export UserService?' — meaning: can other modules inject it?