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

@aevr/notifications

v1.3.4

Published

Multi-channel notification dispatch engine. Send email, in-app, Slack, Discord, Telegram, and webhook notifications from a single API.

Readme

@aevr/notifications

Delivery receipts

Every dispatch() returns a NotificationDispatchResult with one normalized receipt for each recipient/channel attempt. Existing channels that return void remain compatible and are recorded as sent. Channels with provider visibility can return target counts and sent, partial, failed, or unavailable status.

const result = await registry.dispatch(event, data, recipients, channels)

for (const receipt of result.receipts) {
  console.log(receipt.channel, receipt.status, receipt.deliveredTargets)
}

Web Push reports unavailable with NO_PUSH_SUBSCRIPTIONS when a recipient has no registered browser subscription. This prevents a default-enabled channel from being mistaken for a successful delivery. NotificationDispatchOptions also provides an onReceipt observer for durable product-owned persistence.

Multi-channel notification dispatch engine for Node.js. Register renderers per event, dispatch to email, in-app, Slack, Discord, Telegram, and custom webhooks from a single API.

npm license

Install

npm install @aevr/notifications
# peer dep — required only if you use the email channel:
npm install @aevr/mailer

Quick start

import { registerRenderer, dispatch } from "@aevr/notifications";
import { createMailer } from "@aevr/mailer";
import { EmailChannel } from "@aevr/notifications/email";

// 1. Wire up channels
const emailCh = new EmailChannel(createMailer());

// 2. Register a renderer for an event
registerRenderer("user.welcome", {
  email: (data) => ({
    subject: `Welcome, ${data.name}!`,
    body: "Thanks for signing up.",
    html: `<p>Thanks for signing up, <strong>${data.name}</strong>!</p>`,
  }),
});

// 3. Dispatch — fire and forget
await dispatch(
  "user.welcome",
  { name: "Alice" },
  [{ userId: "u1", email: "[email protected]" }],
  [emailCh],
);

Channels

| Import | Channel | Notes | |---|---|---| | @aevr/notifications/email | EmailChannel | Requires @aevr/mailer peer dep | | @aevr/notifications/webhook | createWebhookChannel | HMAC signing, custom body template | | @aevr/notifications/telegram | createTelegramChannel | Message splitting, inline keyboard | | @aevr/notifications/slack | createSlackChannel | Incoming Webhook, Block Kit | | @aevr/notifications/discord | createDiscordChannel | Incoming Webhook, rich embeds | | @aevr/notifications/in-app | createInAppChannel | Injected storage adapter | | @aevr/notifications/push | createWebPushChannel | VAPID Web Push with injected subscription storage |

Web Push

import { createWebPushChannel, testWebPushDelivery } from "@aevr/notifications/push";

const push = createWebPushChannel({
  vapid: {
    subject: "mailto:[email protected]",
    publicKey: process.env.VAPID_PUBLIC_KEY!,
    privateKey: process.env.VAPID_PRIVATE_KEY!,
  },
  storage: {
    getSubscriptions: (userId) => subscriptions.findByUser(userId),
    removeSubscription: (userId, endpoint) => subscriptions.remove(userId, endpoint),
  },
  timeout: 8_000,
});

registerRenderer("product.alert", {
  web_push: (data) => ({
    subject: data.title,
    body: data.message,
    url: data.url,
    meta: { tag: "product-alert" },
  }),
});

The product owns browser subscription HTTP routes and persistence. The channel owns VAPID delivery and removes endpoints that return HTTP 404 or 410. Set timeout to bound each provider request; web-push otherwise has no request timeout.

Normal dispatch() remains fire-and-forget: channel failures are logged and never block other channels. For diagnostics or synchronous workflows, use observable delivery:

const result = await push.sendWithResult(payload, recipient, {
  endpoint: currentBrowserEndpoint, // optional: restrict to this device
});

// Or send a standard diagnostic payload without a renderer:
const test = await testWebPushDelivery(pushConfig, userId, {
  endpoint: currentBrowserEndpoint,
  url: "/settings/notifications",
});

// { attempted, delivered, staleRemoved, failed, storageError }
if (test.attempted === 0) return reply.status(409).send({ error: "No subscription" });
if (test.delivered === 0) return reply.send({ success: false, error: "Provider delivery failed", data: test });

Diagnostic delivery defaults to an 8-second provider timeout, configurable through WebPushChannelConfig.timeout. failed[] includes the endpoint, provider HTTP status when available, and error message. Applications should sanitize or fingerprint endpoints before returning diagnostics to browsers. A 404/410 response removes the endpoint and increments staleRemoved rather than failed. When an edge proxy replaces upstream 5xx bodies, return a readable success: false diagnostic envelope with HTTP 200 after the probe completes.

Retry

import { withRetry } from "@aevr/notifications";

const resilientChannel = withRetry(slackCh, { maxAttempts: 3, backoffMs: 500 });

Isolated registry (multi-tenant / testing)

import { createNotificationRegistry } from "@aevr/notifications";

const { registerRenderer, dispatch } = createNotificationRegistry();

Testing

import { createMockChannel, assertDeliveredTo } from "@aevr/notifications/testing";

const mock = createMockChannel("email");
await dispatch("user.welcome", data, recipients, [mock]);
assertDeliveredTo(mock, "u1");

Types

import type {
  NotificationPayload,
  NotificationRecipient,
  NotificationChannel,
  ChannelRenderer,
} from "@aevr/notifications";

License

MIT