@ternion/bitstream
v0.1.1
Published
Powerful development toolkit for embedded systems and IoT applications.
Maintainers
Readme
@ternion/bitstream
@ternion/bitstream is a command-line toolkit for embedded systems and IoT development.
It helps you manage firmware MQTT/Wi-Fi configuration, run local MQTT infrastructure, and simulate MCU telemetry workflows.
Table of Contents
- Who This Is For
- Requirements
- Install
- Quick Start
- Common Workflows
- Configuration
- Port Conflict Management
- Command Reference
- Troubleshooting
Who This Is For
This package is designed for:
- students and developers working on MQTT-enabled embedded firmware,
- teams using a local frontend dashboard plus MQTT broker,
- users who need repeatable CLI workflows across Windows, macOS, and Linux.
Requirements
- Node.js
20+ - Docker Desktop / Docker Engine is optional (needed only for
bitstream backend ...commands) - Embedded MQTT broker (
bitstream broker ...) works without Docker
Install
Choose one run mode:
- No global install: use
npx @ternion/bitstream ... - Global install: use
bitstream ...directly (nonpxneeded)
Use without global installation:
npx @ternion/bitstream --helpOr install globally:
npm install -g @ternion/bitstream
bitstream --helpAfter global install, run commands as:
bitstream broker start --daemon
bitstream backend up
bitstream simulator startQuick Start
# Start embedded MQTT broker (daemon mode)
npx @ternion/bitstream broker start --daemon
npx @ternion/bitstream broker status
# Start HTTP API used by frontend integrations
npx @ternion/bitstream serve
# Verify command groups
npx @ternion/bitstream --helpCommon Workflows
1) Firmware config updates
npx @ternion/bitstream mqtt-broker docker
npx @ternion/bitstream mqtt-broker base-topic lab/kit-1
npx @ternion/bitstream mqtt-broker client-id kit-01
npx @ternion/bitstream wifi set --ssid MyAP --password "secret"2) Docker Mosquitto lifecycle
npx @ternion/bitstream backend up
npx @ternion/bitstream backend logs
npx @ternion/bitstream backend downDocker compose assets are bundled with this package under docker/, so backend commands work after npm installation.
Use Docker only when you prefer containerized Mosquitto; otherwise use the embedded broker commands.
3) MCU telemetry simulation
npx @ternion/bitstream simulator start
npx @ternion/bitstream simulator status
npx @ternion/bitstream simulator stopConfiguration
Firmware header paths are machine-specific. Set them with environment variables or per-command flags.
Monorepo ROOT (optional)
If your current directory is a ROOT that contains both firmware/ and frontend/:
cd /path/to/ROOT
npx @ternion/bitstream init defaultThis writes ./bitstream.config.json with relative paths. When you run Bitstream from that same ROOT, you can usually skip manual BITSTREAM_*_PATH exports. Use --pull-snapshot to refresh mqtt_client_config.snapshot.json from the header and sync the frontend .env without modifying mqtt_client_config.h (init from existing #defines only). Add --push-header only when you intentionally want the header patched from that snapshot. For firmware-only trees, bitstream mqtt-broker snapshot (no --push) does the same pull-only init.
Windows (PowerShell)
$env:BITSTREAM_CONFIG_PATH = "C:/path/to/mqtt_client_config.h"
$env:BITSTREAM_WIFI_CONFIG_PATH = "C:/path/to/wifi_config.h"
npx @ternion/bitstream servemacOS / Linux (bash/zsh)
export BITSTREAM_CONFIG_PATH="/path/to/mqtt_client_config.h"
export BITSTREAM_WIFI_CONFIG_PATH="/path/to/wifi_config.h"
npx @ternion/bitstream servePer-command path override
npx @ternion/bitstream serve --config "/path/to/mqtt_client_config.h" --wifi-config "/path/to/wifi_config.h"Port Conflict Management
Embedded broker and Docker Mosquitto both use 1883 and 9001 by default.
If those ports are busy:
npx @ternion/bitstream port status 1883
npx @ternion/bitstream port free 1883 9001You can also stop known runtimes directly:
npx @ternion/bitstream broker stop
npx @ternion/bitstream backend downCommand Reference
Key command groups:
broker- embedded MQTT broker lifecyclebackend- Docker Mosquitto lifecyclesimulator- telemetry simulator lifecycle (start,status,stop;mcudeprecated)mqtt-broker- firmware MQTT config updateswifi- firmware Wi-Fi config updatesport- listener inspection and cleanupinit- workspace setup (init defaultfor standard monorepo ROOT)config- runtime config init/show/validatefw- firmwaremakewrappers
For full help:
npx @ternion/bitstream --help
npx @ternion/bitstream help broker
npx @ternion/bitstream help mqtt-brokerTroubleshooting
command not found: bitstream- Use
npx @ternion/bitstream ...or install globally.
- Use
- Port already in use
- Run
port status/port freecommands shown above.
- Run
- Firmware header not found
- Set
BITSTREAM_CONFIG_PATHandBITSTREAM_WIFI_CONFIG_PATH, or pass--config/--wifi-config.
- Set
- Docker command errors
- Ensure Docker Desktop/Engine is running and accessible from your shell.
