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

bunnimq

v1.0.1

Published

node native message broker in pure JS

Readme

Bunni is a 4-day low-level JavaScript experiment I did for fun; and it actually turned out decent.

I wrote it months ago as a joke to see how far I could push barebones JS. After not touching it for a while, I came back and was surprised by how well it worked.

So I marked every code smell and issue (some are really bad) with FIXME tags, for anyone curious to learn low-level JS by doing, checkout the fixmes branch git checkout fixmes.

I am already applying the changes into main, fixmes will remain unmerged.

Pure JavaScript Message Broker (long lived TCP and Buffers)

  • Longed Lived TCP

  • Raw buffers

  • Queue Management, Ack and clean up

  • Client driver based on events and event queues

  • Pub/Sub

  • Bson serialization and Desirialization: Durable queues

  • Handshake and Auth

Getting Started

npm i bunni bunnimq-driver

The message broker

creating bunny:

import Bunny, {OPTS} from "bunnimq"
import path from "path"
import { fileURLToPath } from 'url';

OPTS.cwd = path.dirname(fileURLToPath(import.meta.url))  // used to read .auth file
Bunny({port: 3000, DEBUG:true})  // start a TCP server

Options:

 let DEFAULT_OPTS = {
    port: 3000, 
    DEBUG: true,
    cwd: undefined,
     //  from RabbitMQ not to give more than one message to a worker at a time. Or, in other words, don't dispatch a new message to a worker until it has processed and acknowledged the previous one. Instead, it will dispatch it to the next worker that is not still busy.
    prefetch: 1,   // not implemented
    queue: {
      QueueExpiry: 60,
      MessageExpiry: 30,
      AckExpiry: 30,
      Durable: false,
      noAck: true,

    },
 
 }


create .auth file:


sk:mypassword:4
jane:doeeee:1
john:doees:3

credential: username:password:permissions

const perms = {
    1 : "PUBLISH",
    2 : "CONSUME",
    3 : "PUBLISH|CONSUME",
    4 : "ADMIN"
}

creds will be loaded when Bunny boots up and saved in a sqlite database

Producer/Publisher

import Bunnymq from "bunnimq-driver"


const bunny = new Bunnymq({port: 3000, host:"localhost", username: "sk", password: "mypassword"})
bunny.QueueDeclare({name: "myqueue2", config:  {
    QueueExpiry: 60,
    MessageExpiry: 20,
    AckExpiry: 10,
    Durable: true,
    noAck: false,
}}, (rres)=> {console.log("queu creation:", rres)})

for(let i = 0; i < 100; i++){
    // work simulation
    bunny.Publish(`${Math.random()}-${i+100*8}`, (res)=> {console.log(res)})
}

Consumer/worker


import Bunnymq from "bunnimq-driver"


const bunny = new Bunnymq({port: 3000, host:"localhost", username: "john", password: "doees"})
bunny.QueueDeclare({name: "myqueue2", config: undefined}, (rres)=> {console.log("queu creation:", rres)})

let consumed = 0;
bunny.Consume("myqueue2",  async(msg) => {
    console.log('processing', msg)
    consumed++
    const [id, time] = msg.split("-")
    console.log(id, time)
    await new Promise((resolve) => setTimeout(resolve, time));
    console.log("consumed: ", consumed)
    bunny.Ack((isSuccess) => console.log("free to take more work", isSuccess))
})

NOTES

  • No TLS yet, Just RAW TCP (brokers are servers behinds servers)
  • Use classic queue- I did implement a mapped queue which is way faster Just need to tie it, priority queue next