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

@smartiot-stack/iot-bridge

v1.0.0

Published

A CLI tool for Serial and MQTT IoT communication with a built-in dashboard, mqtt-broker, rest-api server, database, interactive command line interface, logs manager and more.

Readme

IoT Bridge

License: MIT Node.js Version npm version

An all-in-one, open-source tool that bundles everything you need for IoT communication into a single package. Includes a built-in MQTT broker (Aedes), SQLite database, REST API server, interactive web dashboard, WSL USB bridging, comprehensive logs management, and an interactive for real-time device interaction. No need for separate installations just install and start bridging your IoT devices!

Table of Contents

Why IoT Bridge ?

IoT Bridge stands out by providing a complete, self-contained IoT communication suite in a single tool. Instead of piecing together multiple services, get everything you need out-of-the-box:

  • Built-in MQTT Broker: No external broker needed Aedes MQTT server included.
  • Integrated Database: SQLite for logging, no database setup required.
  • REST API Server: Ready-to-use API for integrations.
  • Web Dashboard: Real-time visualization without additional web servers.
  • WSL USB Support: Automatic Windows USB device bridging to WSL.
  • **Interactive **: View logs and send commands simultaneously in the terminal.
  • Multiple Instances: Run several instances at once for multi-device management.
  • Logs Management: Query, filter, and purge logs with ease.

Perfect for hobbyists, developers, and small teams who want powerful IoT tools without the complexity of managing multiple services.

Features

IoT Bridge offers a comprehensive suite of features in a single, easy-to-use package.

All-in-One Solution

  • Built-in MQTT Broker (Aedes): Full MQTT protocol support with client management and topic-based messaging.
  • Integrated SQLite Database: Automatic logging with indexing for fast queries no external DB required.
  • REST API Server: Comprehensive API for log retrieval, statistics, and device control.
  • Interactive Web Dashboard: Real-time charts and command interface using Chart.js and Socket.io.
  • WSL USB Bridging: Seamless auto-mounting of Windows USB devices to WSL environments.
  • Advanced Logs Management: Query by source, date, or custom filters; secure purge options.
  • **Interactive **: Simultaneous log viewing and command sending in the terminal.
  • Multiple Instance Support: Run multiple instances simultaneously for parallel device communication and logging.

Communication Modes

  • Serial Port (USB) Mode: Direct USB serial communication with configurable baud rates and device auto-detection.
  • MQTT Broker Mode: Wireless IoT communication with standard MQTT support.

Additional Capabilities

  • Security Features: JWT authentication, bcrypt password hashing, and secure credential storage.
  • Real-Time Updates: WebSocket-based live data streaming to the dashboard.
  • System Monitoring: Health checks for database, network, and bridge status.
  • Flexible Deployment: Standalone API mode, headless operation, or full interactive experience.

Examples

Serial Communication with Real-Time Logging

$ iot-bridge init
# Select Serial Port (USB), enable logging
✔ LINK ESTABLISHED: /dev/ttyUSB0 @ 9600
YOU > LED ON
Device > LED turned on
# Logs automatically saved to SQLite DB

MQTT Broker with Multiple Clients

$ iot-bridge init
# Select MQTT (Broker)
✔ MQTT Broker Live on PORT: 1883
MQTT SEND > sensors/temp 25.5
[sensors/temp] 25.5
# Multiple clients can connect and logs are unified

Multiple Instances for Multi-Device Setup

# Terminal 1: Serial device
$ iot-bridge init --mode serial --port /dev/ttyUSB0

# Terminal 2: MQTT broker
$ iot-bridge init --mode mqtt --port 1884

# Terminal 3: API server
$ iot-bridge api --port 3001
# All instances share the same database and logs

WSL USB Auto-Bridging

# On WSL, automatic detection and bridging:
Detected USB Devices:
1. ESP32 Dev Board (Bus: 1-2)
? Bridge device: Yes
✔ Device bridged to WSL
# Now accessible as /dev/ttyUSB0

Installation

Prerequisites

  • Node.js >= 16.0.0
  • npm or yarn
  • For Serial mode: USB drivers (usually auto-installed)
  • For WSL: usbipd on Windows host

Global Installation

npm install -g @smartiot-stack/iot-bridge

Local Development

git clone https://github.com/smartiot-stack/iot-bridge.git
cd iot-bridge
npm install
npm link

Quick Start

  1. Setup Admin Credentials:

    iot-bridge setup
    # Set username and password
  2. Start Bridging:

    iot-bridge init
    # Choose Serial or MQTT, enable features
  3. Access Dashboard:

    • Open http://localhost:3005
    • Login and start monitoring
  4. Send Commands & View Logs:

    • Use the interactive
    • Check logs: iot-bridge logs --query

Usage

Core Commands

iot-bridge setup

First-time admin setup.

iot-bridge setup

iot-bridge init

Interactive bridge configuration.

iot-bridge init
# Guided setup for mode selection

iot-bridge api

Standalone API server.

iot-bridge api --port 8080

iot-bridge logs

Log management.

iot-bridge logs --query --source SERIAL
iot-bridge logs --purge --date 2023-10-01

iot-bridge status

System status check.

iot-bridge status

iot-bridge user

Update admin credentials.

iot-bridge user

Advanced Examples

Running Multiple Instances

# Instance 1: Serial bridge
iot-bridge init --mode serial --port /dev/ttyACM0 --baud 115200 --log --api-port 3001

# Instance 2: MQTT broker on different port
iot-bridge init --mode mqtt --mqtt-port 1884 --log --api-port 3002

# Both save to the same database, accessible via different APIs

Integrating with External Tools

  • Grafana: Use /api/stats/:source for metrics
  • Node-RED: HTTP request nodes to API endpoints
  • Custom Scripts: Direct database queries or API calls

Configuration

Configuration stored in ~/.config/iot-bridge/:

  • .config.json: Admin credentials
  • iot_bridge.db: SQLite logs

Environment variables:

  • IOT_BRIDGE_DB_PATH: Custom DB location
  • IOT_BRIDGE_API_PORT: Default API port

API Reference

Authentication

Protected endpoints require JWT:

Authorization: Bearer <token>

Key Endpoints

  • POST /api/login: Get JWT token
  • GET /api/logs: Recent logs
  • GET /api/logs/:source: Filtered logs
  • GET /api/history: Date-range logs
  • GET /api/stats/:source: Aggregated stats
  • GET /api/sources: Unique sources
  • DELETE /api/logs/purge: Delete logs
  • GET /api/heartbeat: System health

Web Dashboard

Access at http://localhost:3005:

  • Live charts with Chart.js
  • Send commands to devices
  • Browse and filter logs
  • Real-time updates via Socket.io

Security

  • JWT tokens (1-hour expiry)
  • Bcrypt password hashing
  • Input sanitization
  • Secure credential storage

Troubleshooting

Common Issues

  1. Serial Port Access: Check permissions (sudo usermod -a -G dialout $USER)
  2. WSL USB: Ensure usbipd is installed and running
  3. Port Conflicts: Change default ports if needed
  4. Database Issues: Check disk space and permissions

Debugging

  • Verbose mode: DEBUG=iot-bridge:* iot-bridge ...
  • Check logs: iot-bridge logs --query

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE

Support

  • GitHub Issues: Report bugs
  • Discussions: Feature requests
  • Conatct: web