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

@repzo/pulsebase-sdk

v0.1.4

Published

PulseBase Node.js SDK — batched, retrying telemetry logger.

Readme

PulseBase Node.js SDK

First SDK target for PulseBase v1. Requires Node.js 18+ (global fetch). Ships as both ESM and CommonJS with bundled type declarations.

import { createLogger } from "@repzo/pulsebase-sdk";

const logger = createLogger({
  ingestionKey: process.env.PULSEBASE_INGESTION_KEY!,
  // endpoint defaults to https://pulsebase-ingest.repzo.me;
  // override with PULSEBASE_ENDPOINT for local dev.
  service: "api",
  environment: "production",
  defaultTags: ["node"]
});

logger.info("Order created", {
  app_tenant_id: "tenant-1",
  app_user_id: "user-1",
  meta: {
    order_id: "ord_123"
  }
});

logger.error(new Error("Payment provider failed"));

await logger.close();

API

createLogger(options)
setupDefaultLogger(options)
getDefaultLogger()

Logger methods:

logger.trace(message, options)
logger.debug(message, options)
logger.info(message, options)
logger.warn(message, options)
logger.error(messageOrError, options)
logger.fatal(messageOrError, options)
logger.http(options)
logger.flush()
logger.close()
logger.addMetaProperty(key, value)
logger.removeMetaProperty(key)

The SDK is fail-open. Ingestion errors are emitted as optional events and dropped after retry exhaustion; application code should not fail because telemetry is unavailable.

Batching

The client buffers in memory and flushes by:

  • interval: flushIntervalMs, default 3000
  • event count: maxBatchSize, default 250
  • payload target: maxBatchBytes, default PULSEBASE_LIMITS.sdkBatchTargetMaxBytes

Retries use exponential backoff with jitter for transient network errors and retryable HTTP statuses.

Compression

Set compress: true to gzip each batch before sending (off by default, async so it stays off the event loop). Batches below compressThreshold bytes (default 1024) are sent as plain JSON, since gzip only pays off on larger payloads. The edge ingestion endpoint decompresses content-encoding: gzip request bodies, so high-volume Node services can cut egress significantly:

const logger = createLogger({
  ingestionKey: process.env.PULSEBASE_INGESTION_KEY!,
  service: "api",
  compress: true
});

Events

logger.on("send", (event) => {})
logger.on("cleared", (event) => {})
logger.on("warn", (event) => {})
logger.on("error", (event) => {})
logger.on("drop", (event) => {})

error is only emitted when a listener is registered, so the logger remains fail-open by default.

When events are dropped (send failed after retries, or buffer overflow) and no drop listener is attached, the SDK logs a throttled console.warn (at most once per 60s) so the loss is never silent. Attach a drop listener to handle it yourself, or pass silent: true to suppress the warning.

Build & Publish

The package is consumed from source inside the monorepo. For external Node services it builds to a self-contained dist (the @pulsebase/schemas workspace package is bundled in):

corepack pnpm --filter @repzo/pulsebase-sdk build   # -> dist/index.js (ESM), index.cjs (CJS), index.d.ts

prepublishOnly runs the build automatically. publishConfig repoints main/module/types/exports at dist for the published tarball, so dev in the monorepo keeps using the TypeScript source.

Express Middleware

import express from "express";
import { createLogger, expressMiddleware } from "@repzo/pulsebase-sdk";

const app = express();
const logger = createLogger({
  ingestionKey: process.env.PULSEBASE_INGESTION_KEY!,
  endpoint: "http://127.0.0.1:8787",
  service: "api"
});

app.use(
  expressMiddleware(logger, {
    getTenantId: (request) => request.user?.tenantId,
    getUserId: (request) => request.user?.id
  })
);

Local Development

Run the edge ingest worker locally, then point the SDK at it:

corepack pnpm --filter @pulsebase/edge-ingest dev:sync-config
corepack pnpm exec wrangler dev \
  -c cloudflare/edge-ingest/wrangler.toml \
  -c cloudflare/queue-consumer/wrangler.toml
PULSEBASE_ENDPOINT=http://127.0.0.1:8787
PULSEBASE_INGESTION_KEY=pbik_...