NestJS: Use a solo @injectable class as a singleton Provider

Panos Zafeiropoulos
Dev Genius
Published in
2 min readMar 18, 2022

--

Intro

NestJS Modules are Singletons by default. Their Providers are also singletons when they are provided from within the same module. However, there are cases where we want to use just a single solo class as a provider to a couple or more modules. In such cases, we can use the solo class as singleton or not. Let’s see how we can do that.

--

--

In my sixties and I am getting more and more passionate about programming! I always stay ready for new development challenges!