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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mini-message-queue

v1.1.1

Published

A lightweight, in-memory message queue with topics, retries, and backoff — Kafka-like but no infra required.

Readme

mini-message-queue

A minimal in-memory message queue for Node.js.
Supports topic-based publish/subscribe, retries, and simple backoff strategies. No external dependencies or ports required.


Features

  • Topic-based publish/subscribe
  • Retry failed jobs with linear or exponential backoff
  • In-memory queue (no external services)
  • Simple monitoring via queue stats
  • Lightweight and minimal

Installation

npm install mini-message-queue

Repository

Github: https://github.com/shishir-subedii/mini-message-queue


Usage

Importing

import { MessageQueue } from 'mini-message-queue';

Creating a queue

const queue = new MessageQueue({
    retry: 5,           // number of retries if a job fails (default: 3)
    delay: 1000,        // base delay between retries in ms (default: 1000)
    backoff: 'exponential' // retry backoff strategy: 'linear' or 'exponential' (default: 'linear')
});

Subscribing to a topic

queue.subscribe('email', async (payload) => {
    console.log('Sending email to:', payload.to);
    // simulate possible failure
    if (Math.random() < 0.3) throw new Error('Email service failed');
});

Publishing a job

queue.publish('email', { to: '[email protected]', subject: 'Hello!' });
queue.publish('email', { to: '[email protected]', subject: 'Alert!' });

Monitoring queue

console.log(queue.stats());
// Example output:
// { queueLength: 2, topics: ['email'] }

Options

| Option | Type | Default | Description | | --------- | --------------------------- | ---------- | ------------------------------- | | retry | number | 3 | Max number of retries per job | | delay | number | 1000 | Base delay between retries (ms) | | backoff | 'linear' \| 'exponential' | 'linear' | Retry delay strategy |


Job Statuses

Each job has a status:

pending — waiting to be processed

processing — currently being handled

retrying — failed but will retry

failed — failed after max retries

completed — successfully processed


Example: Multiple Topics

queue.subscribe('email', async (payload) => { /* handle email */ });
queue.subscribe('sms', async (payload) => { /* handle SMS */ });

queue.publish('email', { to: '[email protected]', subject: 'Welcome!' });
queue.publish('sms', { to: '+1234567890', message: 'Your code is 1234' });

Notes

In-memory only: Jobs are lost if the process exits.

Single instance: No distributed processing or clustering.

Minimal: Great for small apps, testing, or prototyping.


TypeScript Types

import { MessageQueueOptions, Handler } from 'mini-message-queue';

interface MessageQueueOptions {
    retry?: number;       // max retries per job
    delay?: number;       // base delay in ms
    backoff?: 'linear' | 'exponential'; // retry strategy
}

type Handler = (payload: any) => Promise<void>;

📄 License

MIT License © 2025 Shishir Subedi


CONTRIBUTING

🧠 Version Bump Logic (Using phips28/gh-action-bump-version)

That GitHub Action checks the commit messages merged into main.
Depending on what they contain, it bumps the version as follows:

Commit Message Resulting Version Bump
fix: 🔹 patch → 1.0.0 → 1.0.1
feat: 🔸 minor → 1.0.0 → 1.1.0
BREAKING CHANGE: or ! 🔺 major → 1.0.0 → 2.0.0
others (chore:, docs:, test:) no bump

✅ Examples in Your Project
fix: resolve timeout issue (npm version becomes 1.0.1)
feat: add status verification API(npm version becomes 1.1.0)
feat!: change constructor to accept options object(npm version becomes 2.0.0)
docs: update README for new config options(version stays the same)