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

@subhajit60/notification-engine

v1.0.0

Published

A powerful and extensible notification engine for TypeScript applications.

Downloads

20

Readme

@subhajit60/notification-engine

A powerful, extensible, and decorator-based notification engine for TypeScript applications.

Features

  • Decorator Pattern: Easily add priority, timestamps, images, and custom metadata to notifications.
  • Multiple Channels: Built-in support for Email, Telegram, and In-App notifications.
  • Strategy Pattern: Decouple notification logic from delivery services (Nodemailer, Telegram Bots, etc.).
  • Built-in Formatters: Beautifully formatted HTML emails and Telegram messages with customizable templates.
  • Type-Safe: Full TypeScript support with consistent interfaces.

Installation

npm install @subhajit60/notification-engine

Basic Usage

1. Initialize Strategies

Define how your notifications are actually sent by providing "sender" functions to the built-in strategies.

import { 
    NotificationDispatcher, 
    SendEmailNotification, 
    SendTelegramMessage 
} from "@subhajit60/notification-engine";

// Example: Your custom mailer
const mailer = new MyMailer(); 
const myTelegramBot = new MyTelegramBot();

const dispatcher = new NotificationDispatcher({
    email: new SendEmailNotification(mailer.sendHtmlMail.bind(mailer)),
    telegram: new SendTelegramMessage(myTelegramBot.sendMessage.bind(myTelegramBot))
});

2. Build a Notification

Use the built-in builders to create common notification types.

import { buildEmailNotification } from "@subhajit60/notification-engine";

const notification = buildEmailNotification(
    'quiz',      // type
    'success',   // variant
    "Your quiz results are ready!", // message
    "Quiz Success" // title
);

3. Send the Notification

Dispatch the notification to a specific recipient.

await dispatcher.dispatch(notification, "[email protected]");

Advanced Usage: Decorators

You can manually compose notifications using decorators for maximum flexibility.

import { 
    SimpleNotification, 
    PriorityDecorator, 
    TimestampDecorator, 
    ChannelDecorator 
} from "@subhajit60/notification-engine";

let n = new SimpleNotification("alert", "warning", "System maintenance scheduled.");
n = new PriorityDecorator(n, "high");
n = new TimestampDecorator(n);
n = new ChannelDecorator(n, "email");

const payload = n.getContent();

Builders

| Builder | Purpose | |---------|---------| | buildEmailNotification | Creates a high-priority email notification with support for images. | | buildTelegramNotification | Creates a telegram notification with a timestamp and medium priority. | | buildQuizNotification | Standard quiz-related notification for in-app use. | | buildAnnouncementNotification | General announcement for in-app display. |

Strategy Interface

To implement custom delivery, simply extend INotificationStrategy:

import { INotificationStrategy, NotificationPayload } from "@subhajit60/notification-engine";

export class MyCustomStrategy extends INotificationStrategy {
    async send(notification: NotificationPayload, to: string) {
        // Your sending logic here
    }
}

License

ISC