CodeZettaInterview Hub

NestJS · Providers · Junior · Comparison

useFactory vs useClass vs useValue — when?

Short Interview Answer

useValue for constants/mocks; useClass for swappable implementations; useFactory for async/config-dependent construction.

Detailed Explanation

Factories enable ConfigService-driven setup. Prefer explicit tokens for interfaces.

Did you know this answer?