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

mosquitto

v0.9.7

Published

Mosquitto MQTT Broker Turnkey Solution

Downloads

778

Readme

Mosquitto

Mosquitto MQTT Broker Turnkey Solution

github (author stars) github (author followers)

About

This is a Mosquitto turnkey solution, i.e., the combination of an OCI Container ghcr.io/rse/mosquitto and a corresponding TypeScript/JavaScript API mosquitto for use with Node.js, for easily starting an instance of the excellent MQTT broker Eclipse Mosquitto. It was born from the need to have a Mosquitto instance available from within Node.js on the macOS and Linux platforms. The OCI container bundles the Mosquitto program in a portable way. The TypeScript/JavaScript API allows convenient configuration and run-time control of it.

[!NOTE] The TypeScript/JavaScript API requires Mosquitto itself, so this API either requires you to have the mosquitto and mosquitto_passwd commands in your $PATH or requires you to have the docker command in your $PATH (the default).

Installation

$ npm install mosquitto

Usage

import Mosquitto from "mosquitto"
import MQTT      from "mqtt"

/*  start Mosquitto  */
const mosquitto = new Mosquitto()
await mosquitto.start()
await new Promise((resolve) => { setTimeout(resolve, 1000) })

/*  connect to Mosquitto  */
const mqtt = MQTT.connect("mqtt://127.0.0.1:1883", {})
await new Promise<void>((resolve, reject) => {
    mqtt.once("connect", ()    => { resolve() })
    mqtt.once("error",   (err) => { reject(err) })
})
mqtt.end()

/*  stop Mosquitto  */
await mosquitto.stop()
await new Promise((resolve) => { setTimeout(resolve, 1000) })
console.log(mosquitto.logs())

Configuration

TypeScript/JavaScript API

The API class construction accepts an argument of type MosquittoConfig:

/*  Mosquitto configuration types  */
export type MosquittoConfigPasswdEntry = {
    username:     string,
    password:     string
}
export type MosquittoConfigListenEntry = {
    protocol:     "mqtt" | "mqtts" | "ws" | "wss"
    name?:        string
    address:      string
    port:         number
}
export type MosquittoConfig = {
    native:       boolean
    container:    string
    auth:         "builtin" | "plugin"
    persistence:  boolean
    acl:          string
    passwd:       MosquittoConfigPasswdEntry[]
    listen:       MosquittoConfigListenEntry[]
    custom:       string
}

The internal default is:

{
    native:       false,
    container:    "ghcr.io/rse/mosquitto:<version>"
    auth:         "builtin",
    persistence:  false,
    acl:          "",
    passwd:       [ { username: "example", password: "example" } ],
    listen:       [ { protocol: "mqtt", address: "127.0.0.1", port: 1883 } ],
    custom:       ""
}

OCI Container

The OCI Container accepts the following environment variables and their default values:

SUPERVISORD_ETCDIR="/app/etc"
SUPERVISORD_BINDIR="/app/bin"
SUPERVISORD_VARDIR="/app/var"
MOSQUITTO_ETCDIR="/app/etc"
MOSQUITTO_BINDIR="/app/bin"
MOSQUITTO_VARDIR="/app/var"
MOSQUITTO_UID="app"
MOSQUITTO_GID="app"
MOSQUITTO_ADMIN_USERNAME="admin"
MOSQUITTO_ADMIN_PASSWORD="admin"
MOSQUITTO_CUSTOM_USERNAME="example"
MOSQUITTO_CUSTOM_PASSWORD="example"

The OCI Container accepts the following commands:

# start container
$ docker run ghcr.io/rse/mosquitto

# run Mosquitto tools
$ docker run -i -t ghcr.io/rse/mosquitto mosquitto_{pub,sub,rr,passwd,pw}|passwd [...]

# backup/restore data of running container
$ docker exec -i ghcr.io/rse/mosquitto backup|restore [...]

License

Copyright © 2026 Dr. Ralf S. Engelschall Licensed under MIT license