@trap_stevo/servicetide
v0.0.2
Published
Powering the future of system reliability, this solution offers a groundbreaking approach to monitoring and managing service health at any scale. Seamlessly integrating internal checks, external endpoint validation, historical tracking, and real-time broa
Downloads
16
Maintainers
Keywords
Readme
ServiceTide
Real-time service monitoring with precision and control.
Track internal jobs, monitor external endpoints, and broadcast service health across your infrastructure. Simplify uptime tracking, failure detection, and status broadcasting—without the overhead. Designed for fast teams, scalable systems, and legendary reliability.
⚡ Highlights
- Internal + external service registration
- Real-time health checks using custom logic
- REST endpoints for live service dashboards (optional)
- Historical status tracking with overflow handling
- Per-service tags, metadata, and change logs
status-changeandservice-updatedevent hooks- Clean class-based API—no configs, no clutter
📦 Install
npm install servicetide🚀 Quick Start
const ServiceTide = require("@trap_stevo/servicetide");
const tide = new ServiceTide({
broadcastMode : true,
port : 3000,
pollInterval : 10000
});
tide.registerService("MockAPI", {
type : "external",
url : "https://jsonplaceholder.typicode.com/todos/1",
method : "GET",
successCriteria : (data) => !!data,
successMessage : "MockAPI responsive.",
failureMessage : "MockAPI did not respond.",
tags : ["external", "mock"]
});
tide.on("status-change", ({ name, online, message, timestamp }) => {
console.log(`[${timestamp}] ${name}: ${online ? "🟢 ONLINE" : "🔴 OFFLINE"} - ${message}`);
});
tide.on("service-updated", ({ name, updates }) => {
console.log(`[UPDATED] ${name}:`, updates);
});
tide.start();🧠 Service Config Options
| Option | Type | Description |
|------------------------|------------|--------------------------------------------------|
| type | "internal" or "external" | Determines the check source |
| url | string | Endpoint to ping (external only) |
| method | string | HTTP method (default: "GET") |
| check | function | Async function returning true/false (internal) |
| successCriteria | function | Function that evaluates response data |
| successMessage | string | Shown when the check passes |
| failureMessage | string | Shown when the check fails |
| statusEndpointBase | string | Prefix path for REST endpoints (e.g. "/api") |
| requestConfigurations| object | Additional Axios config |
| tags | string[] | Optional categorization |
| maxStatusHistoryLength | number | Defines the max history entries services can store |
| onStatusHistoryOverflow | function | Triggered when history exceeds limit |
| allowedUpdateFields | string[] | Fields that can get updated via updateServiceDetails (optional override) |
🔥 REST Endpoints (if broadcastMode is true)
GET /status— all service statusesGET /status/:serviceName— individual service statusGET /status/tag/:tag— all services with a specific tag
🔗 License
See License in LICENSE.md
Built to keep your stack alive and legendary.
