NestJS · Senior · Question 13 of 75
How do you reduce cold-start time of a Nest app on serverless platforms?
- 1Add more modules to
AppModule - 2Start a new Nest app for every request
- ✓Correct answer: Bundle the app, cache the bootstrapped instance between invocations, lazy-load heavy modules and avoid connecting to many services on startup
Explanation
Initialization (module scanning, DI graph, DB connections) dominates cold starts. Reuse the app across warm invocations.