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

@smarthivelabs-devs/observe-node

v26.3.0

Published

SmartObserve SDK for Node.js, Express, Fastify, and NestJS

Readme

@smarthivelabs-devs/observe-node

Errors, logs, and traces for Node.js. Failed ingest never throws into your app.

Requires Node 22+. Use a server DSN (sk_) from SmartObserve project settings. Public (pk_) keys are for browsers and Expo only.

https://<sk_server_key>@observe.smarthivelabs.dev/<project-slug>

Install

pnpm add @smarthivelabs-devs/observe-node

Start

Call init once at process boot, before the HTTP server listens.

import { SmartObserve } from "@smarthivelabs-devs/observe-node";

SmartObserve.init({
  dsn: process.env.SMARTOBSERVE_DSN,
  environment: process.env.SMARTOBSERVE_ENVIRONMENT ?? "production",
  release: process.env.SMARTOBSERVE_RELEASE,
});

If dsn is omitted, these env vars are used: SMARTOBSERVE_DSN, SMARTOBSERVE_ENVIRONMENT, SMARTOBSERVE_RELEASE. With no DSN, the client is disabled and every call is a no-op.

Unhandled exceptions and promise rejections are captured automatically. Call await SmartObserve.flush() (or close()) on shutdown so the last batch is sent.

What you send

SmartObserve.captureException(err);
SmartObserve.captureMessage("checkout failed", "error", { orderId });
SmartObserve.log.info("ready");
SmartObserve.log.warn("retrying", { attempt: 2 });
SmartObserve.log.error("queue stalled");

SmartObserve.setUser({ id: user.id, username: user.handle });
SmartObserve.setTag("tenant", org.slug);
SmartObserve.setContext("billing", { plan: "pro" });
SmartObserve.addBreadcrumb({ category: "auth", message: "session refreshed" });

await SmartObserve.startSpan({ name: "POST /orders", operation: "http.server" }, async (span) => {
  span.setAttribute("http.route", "/orders");
  return createOrder();
});

setUser(null) / setTag(key, null) / setContext(key, null) clears that field. Pass beforeSend to drop or edit events (return null drops). Sensitive keys such as password, authorization, and cookie are redacted; add more with redactKeys.

Cron monitors

Wrap a scheduled job so SmartObserve knows when it ran, how long it took, and whether it failed. Missed runs (the job never started) and timeouts are detected on the server, even if your scheduler is down.

await SmartObserve.withMonitor("nightly-billing", async () => {
  await runBilling();
}, { schedule: { type: "crontab", value: "0 2 * * *" }, timezone: "Africa/Accra", maxRuntime: 30 });

The monitor is created (or updated) from that config on the first run. Without a config it only tracks reported failures. For manual control:

const checkInId = SmartObserve.captureCheckIn({ monitorSlug: "sync", status: "in_progress" });
// ...
SmartObserve.captureCheckIn({ monitorSlug: "sync", status: "ok", checkInId });

Jobs triggered by the Smart Hive mailer scheduler (schedules.registerHttpJob) wrap their HTTP handler the same way, and the dashboard's Crons page can import mailer schedules directly. Shell scripts can POST /api/v1/monitors/<slug>/check-ins with a server key.

User feedback

const eventId = SmartObserve.captureException(error);
SmartObserve.captureFeedback({ message: "Export kept failing", email: "[email protected]", associatedEventId: eventId });

Frameworks

Express — request spans plus next(err) capture. Mount the error handler last.

import { expressErrorHandler, expressMiddleware } from "@smarthivelabs-devs/observe-node/express";

const client = SmartObserve.init({ dsn: process.env.SMARTOBSERVE_DSN });
app.use(expressMiddleware(client));
app.use(expressErrorHandler(client));

Fastify — captures onError hook failures.

import { fastifyPlugin } from "@smarthivelabs-devs/observe-node/fastify";

const client = SmartObserve.init({ dsn: process.env.SMARTOBSERVE_DSN });
await app.register(fastifyPlugin(client));

NestJS — global exception filter.

import { SmartObserveExceptionFilter } from "@smarthivelabs-devs/observe-node/nest";

const client = SmartObserve.init({ dsn: process.env.SMARTOBSERVE_DSN });
app.useGlobalFilters(new SmartObserveExceptionFilter(client));

Outgoing http / https requests are breadcrumbed when trackHttp is on (default). OpenTelemetry context is used for parent spans when present.

Options

| Option | Default | Notes | | --- | --- | --- | | dsn | SMARTOBSERVE_DSN | Server key DSN | | environment | SMARTOBSERVE_ENVIRONMENT or NODE_ENV | Shown on issues | | release / dist | SMARTOBSERVE_RELEASE | Tie events to a deploy | | enabled | true if DSN is set | Set false in tests | | debug | false | Logs transport failures | | errorSampleRate | 1 | 0–1 | | tracesSampleRate | 0.1 | Root transactions | | sendDefaultPii | false | Include email / IP on user | | trackHttp | true | Outbound Node HTTP |

API

SmartObserve.init · captureException · captureMessage · log · setUser · setTag · setContext · addBreadcrumb · startSpan · beforeSend · flush · close · SmartObserveClient