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

@heliosiq/core

v1.0.0

Published

Core functionality for HeliosIQ

Readme

Core Service

The core package provides essential services and configurations for interacting with monitoring systems and managing alerts and metrics. This module is part of the HeliosIQ project and leverages secure API integrations for monitoring and alerting functionalities.

Overview

This package handles the configuration and setup for interacting with external monitoring services, such as Prometheus and Grafana, and includes services for managing alerts and querying metrics. It also integrates encryption and sanitization mechanisms for sensitive data.

Key Features

  • Configuration: The configuration module reads environment variables for connecting to Prometheus, Grafana, and AlertManager. It also validates the presence of necessary environment variables.
  • Alerting: The AlertService enables the creation, retrieval, and status updates of alerts, with support for encryption and sanitization of sensitive data.
  • Metrics: The MetricsService facilitates querying of Prometheus metrics, with support for time-based filtering and encryption of sensitive data.

Installation

To install this package, run the following command:

npm install @heliosiq/core

Configuration

The core package relies on several environment variables for proper configuration. These variables can be set in your environment or within a .env file.

Required Environment Variables

  • PROMETHEUS_URL: The URL for the Prometheus server.
  • GRAFANA_URL: The URL for the Grafana server.
  • ALERTMANAGER_URL: The URL for the AlertManager server.
  • API_KEY: A 32-character minimum API key for authorization with the monitoring services.
  • ENCRYPTION_KEY: A 32-character minimum encryption key for securing sensitive data.
  • RATE_LIMIT_WINDOW_MS: The rate limit window in milliseconds.
  • RATE_LIMIT_MAX_REQUESTS: The maximum number of requests allowed within the rate limit window.

Example .env File

PROMETHEUS_URL=https://prometheus.example.com 
GRAFANA_URL=https://grafana.example.com 
ALERTMANAGER_URL=https://alertmanager.example.com 
API_KEY=your-api-key-here 
ENCRYPTION_KEY=your-encryption-key-here 
RATE_LIMIT_WINDOW_MS=1000 
RATE_LIMIT_MAX_REQUESTS=100

Usage

Config Module

The config module reads the environment variables and validates them. If any required variables are missing or invalid, the application will terminate with an error message.

import { config } from '@heliosiq/core';

// Access configuration properties
const prometheusUrl = config.monitoring.prometheusUrl;

Alerts Service

The AlertService provides methods for creating, fetching, and updating alerts.

Create Alert

import { AlertService } from '@heliosiq/core';

const alertService = new AlertService();

const alert = {
  id: 'alert-123',
  severity: 'critical',
  title: 'High CPU Usage',
  description: 'CPU usage exceeds threshold',
  timestamp: new Date(),
};

await alertService.createAlert(alert);

Get Alerts

const alerts = await alertService.getAlerts({
  severity: 'critical',
});

Update Alert Status

await alertService.updateAlertStatus('alert-123', 'resolved');

Metrics Service

The MetricsService provides methods for querying Prometheus metrics.

Query Metrics

import { MetricsService } from '@heliosiq/core';

const metricsService = new MetricsService();

const query = {
  query: 'up{job="my-service"}',
  timeRange: {
    start: new Date(Date.now() - 3600000), // 1 hour ago
    end: new Date(),
  },
};

const metrics = await metricsService.queryMetrics(query);

Get Resource Metrics

const resourceMetrics = await metricsService.getResourceMetrics('cpu_usage');

Types

The types module includes type definitions for the data structures used in the services.

Alerts

interface Alert {
  id: string;
  severity: 'critical' | 'high' | 'medium' | 'low';
  title: string;
  description: string;
  timestamp: Date;
  source: string;
  metadata?: Record<string, any>;
}

MetricQuery

interface MetricQuery {
  query: string;
  timeRange: {
    start: Date;
    end: Date;
  };
  filters?: Record<string, string>;
}

MetricData

interface MetricData {
  name: string;
  values: Array<{
    timestamp: number;
    value: number;
  }>;
  labels: Record<string, string>;
}