Quik Framework :: healthcheck
- Codename: Berlin
- Version: 0.2.0-beta.76
- License: Check license here
Registers healthcheck utilities and HTTP endpoints. The module sets up an
IQHealthcheck feature for tracking component status and exposes readiness
routes when the HTTP engine is available.
Installation
npm install @quik/healthcheck
Usage
Register and update healthcheck items:
import { getFeatureInstance, type IQHealthcheck } from '@quik/core';
const healthcheck = getFeatureInstance<IQHealthcheck>('IQHealthcheck');
healthcheck.register('database');
healthcheck.ready('database');
Register active checks with timeouts:
import { HealthcheckStatus } from '@quik/core';
import { QHealthcheck } from '@quik/healthcheck';
const healthcheck = new QHealthcheck();
healthcheck.registerCheck('cache', async () => {
// return true/false or a HealthcheckStatus
return HealthcheckStatus.OK;
}, { timeoutMs: 1000, onErrorStatus: HealthcheckStatus.DEGRADED });
await healthcheck.runChecks();
When @quik/http is present, the module registers healthcheck routes during
onAfterInit.
Routes
GET /healthreturns a basic uptime payload.GET /readyaggregates status from registered items and returns503when any item is pending, unready, degraded, or down.
API Highlights
QHealthcheckstores in-memory status per item.QHealthcheckRouteexposes health/readiness endpoints.- Status helpers:
ok,ready,pending,degraded,down,unready. registerCheck+runChecksallow executing checks with timeouts and error classification.
Testing & Coverage
See the root instructions for details on running pnpm run test:coverage and accessing coverage artifacts.
API Reference
Generated API documentation is available in the healthcheck API section.