Dependency Injection Scopes In NestJS

İbrahim Gündüz
2 min readMar 25, 2023

NestJS is one of the best server-side framework alternatives with the features it presents. Today we’re going to mention some secret power of the IoC container that comes out of the box with NestJS.

Normally, the framework manages providers` lifetime as singleton. In other words, having stateful objects in the container may create some issues. Let’s take a look at the following example:

--

--