• Stars
    star
    633
  • Rank 68,390 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terminus module for Nest framework (node.js) 🤖

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Discord Backers on Open Collective Sponsors on Open Collective

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
npm install

# To rebuild the project, run
npm run build

Test

For unit testing run the following command:

npm run test

For e2e testing, make sure you have docker installed

docker-compose up -d
npm run 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.

More Repositories

1

nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
TypeScript
64,389
star
2

awesome-nestjs

A curated list of awesome things related to NestJS 😎
9,674
star
3

nest-cli

CLI tool for Nest applications 🍹
TypeScript
1,868
star
4

typeorm

TypeORM module for Nest framework (node.js) 🍇
TypeScript
1,825
star
5

typescript-starter

Nest framework TypeScript starter ☕
TypeScript
1,753
star
6

swagger

OpenAPI (Swagger) module for Nest framework (node.js) 🌎
TypeScript
1,590
star
7

graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
TypeScript
1,414
star
8

docs.nestjs.com

The official documentation https://docs.nestjs.com 📕
TypeScript
1,101
star
9

cqrs

A lightweight CQRS module for Nest framework (node.js) 🎈
TypeScript
791
star
10

throttler

A rate limiting module for NestJS to work with Fastify, Express, GQL, Websockets, and RPC 🧭
TypeScript
580
star
11

bull

Bull module for Nest framework (node.js) 🐮
TypeScript
567
star
12

jwt

JWT utilities module based on the jsonwebtoken package 🔓
TypeScript
562
star
13

passport

Passport module for Nest framework (node.js) 🔑
TypeScript
477
star
14

mongoose

Mongoose module for Nest framework (node.js) 🍸
TypeScript
476
star
15

config

Configuration module for Nest framework (node.js) 🍓
TypeScript
467
star
16

ng-universal

Angular Universal module for Nest framework (node.js) 🌷
TypeScript
440
star
17

serve-static

Serve static websites (SPA's) using Nest framework (node.js) 🥦
TypeScript
432
star
18

elasticsearch

Elasticsearch module based on the official elasticsearch package 🌿
TypeScript
365
star
19

schematics

Nest architecture element generation based on Angular schematics 🎬
TypeScript
355
star
20

mapped-types

Configuration module for Nest framework (node.js) 🐺
TypeScript
349
star
21

schedule

Schedule module for Nest framework (node.js) ⏰
TypeScript
325
star
22

sequelize

Sequelize module for Nest framework (node.js) 🍈
TypeScript
210
star
23

axios

Axios module for Nest framework (node.js) 🗂
TypeScript
202
star
24

serverless-core-deprecated

[Deprecated] Serverless Core module for Nest framework (node.js) 🦊
TypeScript
168
star
25

event-emitter

Event Emitter module for Nest framework (node.js) 🦋
TypeScript
167
star
26

azure-func-http

Azure Functions HTTP adapter for Nest framework (node.js) 🌥
TypeScript
146
star
27

nestjs.com

The official website https://nestjs.com 🏆
HTML
127
star
28

javascript-starter

Nest framework JavaScript (ES6, ES7, ES8) + Babel starter 🍰
JavaScript
111
star
29

courses.nestjs.com

Official NestJS Courses website https://courses.nestjs.com 🏡
HTML
104
star
30

azure-database

Azure CosmosDB Database module for Nest framework (node.js) ☁️
TypeScript
101
star
31

cache-manager

Cache manager module for Nest framework (node.js) 🗃
TypeScript
99
star
32

azure-storage

Azure Storage module for Nest framework (node.js) ☁️
TypeScript
83
star
33

azure-serverless-deprecated

[Deprecated] Azure Serverless module for Nest framework (node.js) 🌩
TypeScript
44
star
34

enterprise.nestjs.com

The official website https://enterprise.nestjs.com 🌁
HTML
15
star
35

newsletter.nestjs.com

Official NestJS Newsletter website https://newsletter.nestjs.com 📩
HTML
3
star