From 6f8fd14bba007d8f7f0af9d65c7a9ad32a9bae64 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 15 Jun 2025 13:31:42 -0700 Subject: [PATCH] docs: clarify lifecycle events I stumbled upon this in https://www.mrnice.dev/posts/nestjs-lifecycle/ and it confused me and my teammates. Thought it would be useful to clarify this --- content/fundamentals/lifecycle-events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/fundamentals/lifecycle-events.md b/content/fundamentals/lifecycle-events.md index 3318cc661d..0172f529a8 100644 --- a/content/fundamentals/lifecycle-events.md +++ b/content/fundamentals/lifecycle-events.md @@ -18,7 +18,7 @@ In the following table, `onModuleDestroy`, `beforeApplicationShutdown` and `onAp | Lifecycle hook method | Lifecycle event triggering the hook method call | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `onModuleInit()` | Called once the host module's dependencies have been resolved. | +| `onModuleInit()` | Called once the host module's dependencies have been resolved. "Once" meaning called AFTER the host module's dependencies have been resolved, but not necessarily one time only. | | `onApplicationBootstrap()` | Called once all modules have been initialized, but before listening for connections. | | `onModuleDestroy()`\* | Called after a termination signal (e.g., `SIGTERM`) has been received. | | `beforeApplicationShutdown()`\* | Called after all `onModuleDestroy()` handlers have completed (Promises resolved or rejected);
once complete (Promises resolved or rejected), all existing connections will be closed (`app.close()` called). |