# ShutdownHooksOptions

**Kind:** Interface

**Source:** [`packages/common/interfaces/shutdown-hooks-options.interface.ts`](https://github.com/nestjs/nest/blob/master/packages/common/interfaces/shutdown-hooks-options.interface.ts#L6)

**Part of:** [Common](subsystem-packages-common)

Options for configuring shutdown hooks behavior.

`ShutdownHooksOptions` configures how application shutdown hooks behave. It currently controls whether the shutdown process should explicitly terminate the Node.js process after registered cleanup handlers have completed.

## Properties

| Property | Type |
|---|---|
| `useProcessExit` | `boolean` |

## Diagram

```mermaid
graph LR
  A[Application shutdown signal] --> B[Shutdown hooks handler]
  B --> C[Run registered cleanup hooks]
  C --> D{useProcessExit?}
  D -->|true| E[Call process.exit]
  D -->|false| F[Allow event loop to exit naturally]
```

## Usage

```ts
import type { ShutdownHooksOptions } from '@package/common';

const shutdownOptions: ShutdownHooksOptions = {
  useProcessExit: true,
};

// Pass options when configuring the application's shutdown handling.
configureShutdownHooks(shutdownOptions);
```

## AI Coding Instructions

- Set `useProcessExit` to `true` only when the application must terminate immediately after cleanup hooks finish.
- Prefer `false` when open resources should be allowed to close naturally through the Node.js event loop.
- Ensure shutdown hooks complete asynchronous cleanup before process termination is triggered.
- Keep this interface focused on shutdown behavior; add new lifecycle configuration options as explicit, typed fields.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (1)

- `NestApplicationContext` — `packages/core/nest-application-context.ts`:40
