npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@seas-computing/nestjs-healthcheck

v0.1.0

Published

A standalone healthcheck module for NestJS apps

Readme

NestJS HealthCheck Module

The nestjs-healthcheck package provides a standalone NestJS module that verifies the availability of essential application dependencies. This includes:

  • pinging the application database using TypeOrmHealthIndicator
  • performing an HTTP ping to the HarvardKey OIDC discovery document URL using HttpHealthIndicator
  • pinging Valkey with a custom ValkeyHealthService It returns a composite health status result and the current app version. It is intended to be included in a larger application and assumes the presence of a Valkey connection and database connection during runtime.

Installation

npm install @seas-computing/nestjs-healthcheck

Usage

To add the nestjs healthcheck system, you should make the following changes in the consuming application's AppModule (or other root module):

  • be sure that the ConfigModule is at the top of the imports list
  • import and register the HealthcheckModule using registerAsync
  • import TypeOrmModule
  • import a ValkeyModule to provide the Valkey Client (see example in oap-grad-database

In the ConfigService, configuration values (i.e. HealthcheckModuleOptions) should be made available and passed as options to the HealthcheckModule.

Example app.module based on oap-grad-database:

import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
import { LogMiddleware, LogModule } from '@seas-computing/nestjs-logging';
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
import { HarvardKeyModule } from '@seas-computing/nestjs-harvard-key';
import { SessionModule, NestSessionOptions } from 'nestjs-session';
import { RedisStore } from 'connect-redis';
import { HealthcheckModule, HealthcheckModuleOptions } from '@seas-computing/nestjs-healthcheck';
import Valkey from 'iovalkey';
import { ConfigModule } from './config/config.module';
import { ConfigService } from './config/config.service';
import { HealthCheckModule } from './healthCheck/healthCheck.module';
import { VALKEY_CONNECTION_TOKEN } from './valkey/valkey.token';
import { ValkeyModule } from './valkey/valkey.module';

@Module({
  imports: [
    ConfigModule,  // Ensure this is at the top
    HealthCheckModule,
    ValkeyModule,
    LogModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => config.logLevel,
    }),
    HarvardKeyModule.registerAsync({
      inject: [ConfigService],
      imports: [ConfigModule],
      useFactory: (
        config: ConfigService
      ) => ({
        ...config.harvardKeyConfig,
      }),
    }),
    TypeOrmModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (
        config: ConfigService
      ): TypeOrmModuleOptions => ({
        ...config.dbOptions,
        maxQueryExecutionTime: 1000,
      }),
    }),
    HealthcheckModule.registerAsync({
      imports: [ConfigModule, ValkeyModule],
      inject: [
        ConfigService,
        {
          token: VALKEY_CONNECTION_TOKEN,
          optional: false,
        },
      ],
      useFactory: (
        configService: ConfigService,
        valkeyClient: Valkey
      ): HealthcheckModuleOptions => {
        return {
          ...configService.healthcheckConfig,
          valkeyClient,
        };
      },
    }),
  ],
  controllers: [],
  providers: [],
})

class AppModule implements NestModule {
  /**
   * Apply our logging middleware for all routes except the healthcheck
   */
  configure(consumer: MiddlewareConsumer): void {
    consumer
      .apply(LogMiddleware)
      .exclude(
        'heartbeat',
        { path: 'oapGradDatabase/health-check', method: RequestMethod.ALL }  // exclude healthcheck
      )
      .forRoutes('*');
  }
}

export { AppModule };

Examples of additions to config.service.ts from oap-grad-database:

/**
 * Returns the OIDC discovery document URL, which will be sent to the
 * Healthcheck Module. The /.well-known/openid-configuration endpoint
 * is the standard, unauthenticated health signal exposed by all OIDC
 * providers.
 */
public get oidcCheckURL(): string {
  return `${this.oidcBaseURL}/.well-known/openid-configuration`;
}

public get healthcheckConfig(): HealthcheckModuleOptions {
    return {
      oidcCheckURL: this.oidcCheckURL,
      dbOptions: this.dbOptions,
      buildVersion: this.buildVersion,
      strategy: this.isProduction
        ? HEALTH_STRATEGY_NAME.HEALTHCHECK
        : HEALTH_STRATEGY_NAME.DEV,
    };
  }

Sample Response

After running

curl http://127.0.0.1:3001/[yourAppName]/health-check

from the cli, you should receive a response that looks like this:

{
  "status": "ok",
  "info": {
    "database": {
      "status": "up"
    },
    "harvard-key": {
      "status": "up"
    },
    "valkey": {
      "status": "up",
      "result": "PONG"
    }
  },
  "error": {},
  "details": {
    "database": {
      "status": "up"
    },
    "harvard-key": {
      "status": "up"
    },
    "valkey": {
      "status": "up",
      "result": "PONG"
    }
  }
}