Contributors Forks Stargazers Issues MIT License LinkedIn

Logo nodejavascript.com

selfhosted-mqtt-broker-nodejs

Simple MQTT broker written in nodejs, local persistence, minimal stdout with docker. Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project

  2. Getting Started

  3. Contributing
  4. License
  5. Contact
  6. Acknowledgments

About The Project

Run this project on docker with a single command, npm run docker and you’re ready to connect and use this slim MQTT broker with minimal event logging.

Logging via terminal, or looks nice like this using Dozzle: stdout-screen-shot

Client app used for above logs: client-app-screen-shot

Built With

Getting Started

Use this to spin up a dockerized MQTT broker. I use it to connect various Tasmota devices and collect metrics with hub.docker.com/r/kpetrem/mqtt-exporter. This project was authored May 5, 2021, 7:35 PM privately on GitLab for about a year until I made it opensource.

Prerequisites

Learn about MQTT and installing a client which are readily available on desktops and play stores. Anything that publishes to MQTT can use this as a broker.

Installation

  1. Review ./package.json for dependencies.

  2. Clone the repo

    git clone https://github.com/nodejavascript/selfhosted-mqtt-broker-nodejs.git
  3. Change directory, make an .env file

      cd selfhosted-mqtt-broker-nodejs && touch .env
  4. Edit the .env file and enter credentials

      AEDES_PORT=1883
      AEDES_BROKER_NAME=my-broker-name
      AEDES_BROKER_CONCURRENCY=50
      AEDES_USERNAME=common-username
      AEDES_PASSWORD=common-password
  5. Create docker container

    npm run docker

    if success, look for docker container named selfhosted-mqtt-broker-nodejs

  6. Run locally

    npm i && npm start

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag “enhancement”. Don’t forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Acknowledgments

GitHub

View Github