resourcio-health-sdk
v1.0.0
Published
Lightweight SDK for project health monitoring — add to any Node.js project
Downloads
90
Readme
resourcio-health-sdk
Lightweight, zero-dependency SDK for monitoring project health. Add to any Node.js project to send heartbeats and error reports to the Health Checkup relay server.
Installation
npm install resourcio-health-sdkQuick Start
import { HealthCheckup } from 'resourcio-health-sdk';
HealthCheckup.init({
projectId: 'my-client-project',
serverUrl: 'https://your-relay-server.com',
apiKey: 'your-api-key',
});That's it! The SDK will now:
- ✅ Send heartbeats every 30 seconds
- ✅ Catch and report uncaught exceptions
- ✅ Catch and report unhandled promise rejections
Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| projectId | string | required | Unique project identifier |
| serverUrl | string | required | Relay server URL |
| apiKey | string | required | API key for authentication |
| heartbeatInterval | number | 30000 | Heartbeat interval (ms) |
| captureErrors | boolean | true | Catch uncaught exceptions |
| captureRejections | boolean | true | Catch unhandled rejections |
| metadata | object | undefined | Custom key-value pairs sent with every report |
| debug | boolean | false | Enable verbose console logging |
Manual Error Reporting
try {
await riskyOperation();
} catch (err) {
HealthCheckup.reportError(err);
}Custom Events
HealthCheckup.reportEvent('deployment', { version: '1.2.3', env: 'production' });Graceful Shutdown
HealthCheckup.shutdown();The SDK also auto-cleans up on SIGTERM and SIGINT.
Platform Compatibility
| Platform | Works? | |----------|--------| | Node.js 16+ | ✅ | | Vercel Serverless | ✅ | | AWS Lambda | ✅ | | Strapi | ✅ | | Express/Fastify | ✅ |
