11.0.0 • Published 10 months ago

@nestjs/terminus v11.0.0

Weekly downloads
72,493
License
MIT
Repository
github
Last release
10 months ago

Description

This module contains integrated healthchecks for Nest.

Installation

@nestjs/terminus integrates with a lot of cool technologies, such as typeorm, grpc, mongodb, and many more! In case you have missed a dependency, @nestjs/terminus will throw an error and prompt you to install the required dependency. So you will only install what is actually required!

npm install --save @nestjs/terminus

Usage

  1. Import the Terminus module
  2. Make sure the additionally needed modules are available to (e.g. TypeOrmModule), in case you want to do Database Health Checks.
// app.module.ts

@Module({
  controllers: [HealthController],
  imports:[
    // Make sure TypeOrmModule is available in the module context
    TypeOrmModule.forRoot({ ... }),
    TerminusModule
  ],
})
export class HealthModule { }
  1. Setup your HealthController which executes your Health Check.
// health.controller.ts

@Controller('health')
export class HealthController {
  constructor(
    private health: HealthCheckService,
    private db: TypeOrmHealthIndicator,
  ) {}

  @Get()
  @HealthCheck()
  readiness() {
    return this.health.check([
      async () => this.db.pingCheck('database', { timeout: 300 }),
    ]);
  }
}

If everything is set up correctly, you can access the healthcheck on http://localhost:3000/health.

{
  "status": "ok",
  "info": {
    "database": {
      "status": "up"
    }
  },
  "details": {
    "database": {
      "status": "up"
    }
  }
}

For more information, see docs. You can find more samples in the samples/ folder of this repository.

Contribute

In order to get started, first read through our Contributing guidelines.

Setup

Setup the development environment by following these instructions:

  1. Fork & Clone the repository
  2. Install the dependencies
pnpm i
pnpm dev

In order to test the library against a sample, simply go to a sample and run pnpm start:dev

cd sample/000-dogs-app
pnpm start:dev

!NOTE Once the library is rebuilt, the pnpm start:dev within a sample needs to be restarted in order to pick up the changes.

Test

For unit testing run the following command:

pnpm test

For e2e testing, a Docker Compose stack is required. Make sure Docker is installed on your machine and run the following command.

docker compose up -d
pnpm test:e2e

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

@nerwin/commondevices-serviceyealinkdevices-serviceventaja-bill-paymentventaja-bill-paymentsservice-task@merkaly/serverdefiyield-backendhutbot-backend-nestjs-core@thekhanj/first-package@jschneller/nestjs-health-check@infinitebrahmanuniverse/nolb-_nes@bytebean/core@uponcommerce/coretypes-kohort@everything-registry/sub-chunk-641taxi-back-commons@corvina/corvina-device-exampleivy-nestjsjei-community-backendigighomebridge-ambient-huehealthz-moduleld-0001-general@wildboar/meerkat-dsa@wepublish/api@vendure/core@vendx/core@waveshq/standard-api-express@waveshq/standard-api-fastify@tresdoce-nestjs-toolkit/health@tnx-pkg/nestjs-starter@toolshub/shared@tricky-max/nestjs-pubsub-health-check@tresdoce/nestjs-health@vdtn359/nestjs-api-bootstrap@vodea/nest-hc@voiceflow/general-runtime@voiceflow/event-ingestion-service@usemonitang/monita-libs@utechzo-erp/core@yasht-simform/project-name-database@zalastax/nolb-_nes@telia-ace/alliance-databasesanalytics-module@ztechapps/app.healthafcon-shared-codeafcon-shared-code-testaccount-service-commandasuna-node-server@goodandco/nest-health@gseller/core@tiennguyen17t2/common-lib-2@adaliszk/nestjssrv.libtonightpassunique-sdk@lan10rdjs/common-ns@laboratory-one/api-components@lanl0rdjs/common-ns@lenne.tech/nest-server@shopness/core@shopness/core-venduremonita-libsroom-assistantroom-assistant2sb-license-backendnestjs-eventstore-dbnew-ptengine-backend-commonnetlabs-njs-commonnest-js-hcnest-pretnestjs-jump-startnestjs-librammitmq-health-check@oasisdex/nestjs@openapps/ntx-core@ordzaar/standard-api-fastify@iasiakencheng/vendure-core@ghentcdh/tools-api@fendylie/nest-core@infineit-nestjs/services@infotecnologia/package-locavia-web@ftw-cloud/core@galaxyops/api@galaxyops/billing-system@galaxyops/character-sheet@galaxyops/constructs@galaxyops/dynamo-image@galaxyops/email-service@galaxyops/html-to-pdf@galaxyops/instances@galaxyops/jukebox@galaxyops/lambda-layers@galaxyops/luck-by-dice@galaxyops/message-bus@galaxyops/player-achievements@galaxyops/user-service@galaxyops/weather-control@phreakazoid21/homebridge-ambient-hue
10.3.0

10 months ago

11.0.0-beta.0

10 months ago

11.0.0-beta.1

10 months ago

11.0.0

10 months ago

10.3.0-beta.0

1 year ago

10.3.0-beta.1

1 year ago

10.2.3

2 years ago

10.2.2

2 years ago

10.2.2-beta.0

2 years ago

10.2.1

2 years ago

10.2.0

2 years ago

10.1.1-beta.0

2 years ago

10.1.0

2 years ago

10.1.1

2 years ago

10.2.0-beta.0

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

10.0.0-beta.1

2 years ago

9.2.2

3 years ago

10.0.0-beta.0

3 years ago

9.2.1

3 years ago

9.2.0

3 years ago

9.2.0-beta.0

3 years ago

9.1.4

3 years ago

9.1.3

3 years ago

9.1.3-beta.0

3 years ago

9.1.2

3 years ago

8.0.8

3 years ago

8.0.7

3 years ago

9.0.0-next.1

3 years ago

8.1.0

3 years ago

8.1.1

3 years ago

9.1.1

3 years ago

9.1.0

3 years ago

9.0.0

3 years ago

8.1.0-beta.1

3 years ago

8.1.0-beta.0

3 years ago

8.0.5

4 years ago

8.0.6

4 years ago

8.0.4

4 years ago

8.0.3

4 years ago

8.0.2

4 years ago

8.0.1

4 years ago

9.0.0-next.0

4 years ago

8.0.0-next.8

4 years ago

8.0.0

4 years ago

8.0.0-next.7

4 years ago

8.0.0-next.6

4 years ago

8.0.0-next.3

4 years ago

8.0.0-next.2

4 years ago

8.0.0-next.5

4 years ago

8.0.0-next.4

4 years ago

8.0.0-next.1

4 years ago

8.0.0-next.0

4 years ago

7.2.0

4 years ago

7.2.0-next.0

5 years ago

7.1.2

5 years ago

7.1.1

5 years ago

7.1.0

5 years ago

7.1.0-next.1

5 years ago

7.1.0-next.0

5 years ago

7.0.1

6 years ago

7.0.0

6 years ago

7.0.0-pre.5

6 years ago

7.0.0-pre.4

6 years ago

7.0.0-pre.3

6 years ago

7.0.0-pre.2

6 years ago

7.0.0-pre.1

6 years ago

6.5.6

6 years ago

6.5.4

6 years ago

6.5.5

6 years ago

6.5.3

6 years ago

6.5.2

6 years ago

6.5.1

6 years ago

6.5.0

6 years ago

6.4.0

6 years ago

6.3.4

6 years ago

6.3.3

6 years ago

6.3.2

6 years ago

6.3.1

6 years ago

6.3.0-rc.1

6 years ago

6.3.0

6 years ago

6.2.0

6 years ago

6.2.0-rc.0

6 years ago

6.1.5

6 years ago

6.1.4

7 years ago

6.1.3

7 years ago

6.1.2

7 years ago

6.1.1

7 years ago

6.1.0

7 years ago

6.0.0

7 years ago

5.6.0

7 years ago

5.5.2

7 years ago

5.5.1

7 years ago

5.5.0

7 years ago