CodeZettaInterview Hub

NestJS · Providers · Mid-Level · Architecture

Transient vs request vs singleton scope — trade-offs?

Short Interview Answer

Default singleton is shared; request scope per HTTP request; transient new per injection — scopes affect memory and graph.

Detailed Explanation

Request-scoped providers force dependents request-scoped (bubble). Use sparingly for tenancy needs; prefer ALS or explicit params when possible.

Did you know this answer?