$ show emqx/MQTTX
MQTTX is a cross-platform MQTT 5.0 client tool developed by EMQ, available as a desktop application (Electron + Vue), a web application (Vue), and a command-line interface (Node.js). It allows users to connect to MQTT brokers, publish and subscribe to topics, inspect messages, and manage connections with support for MQTT 5.0 features, TLS, WebSocket, and various payload formats (JSON, Base64, Hex, CBOR, MsgPack, Protobuf, Avro). It also includes an AI Copilot for MQTT assistance, a dashboard with real-time widgets, and scripting capabilities for payload transformation. The desktop app uses Electron with Vue 2, Element UI, TypeORM with SQLite for persistence, and MQTT.js for MQTT protocol. The web app shares many Vue components but uses lowdb/LocalStorage. The CLI is a separate Node.js package with its own test suite. The codebase is organized into shared utilities, database services, Vue components, and AI integration modules. Key entry points include src/background.ts (Electron main process), src/main.ts (render process), cli/bin/index.js (CLI), and web/src/main.ts (web app). Data flows involve MQTT connection lifecycle, message buffering via RxJS, payload conversion pipelines, and database persistence for messages, subscriptions, and settings. External dependencies include MQTT.js for MQTT protocol, TypeORM for database ORM, Electron for desktop, Vue 2 and Element UI for UI, Monaco Editor for code editing, ECharts for charts, and various AI SDKs (OpenAI, Anthropic, etc.) for the Copilot feature. The project also includes custom patches for third-party libraries (Monaco clipboard, MCP SDK, Azure SDK). The CLI depends on commander, chalk, and @faker-js/faker for simulation. While primarily an application, MQTTX includes data-oriented features such as message history querying with SQL recursive CTEs, topic tree persistence, data export/import in multiple formats, and IoT data simulation scenarios. These elements serve the application's debugging and testing purpose but demonstrate data engineering patterns.
The LLM identified 5 files worth highlighting for reuse:
Implements MQTT topic wildcard matching (+ and #) with support for shared subscriptions and system topics. Used by both desktop and web apps for subscription filtering and message routing. Self-contained and reusable in any MQTT-related project.
Implements SCRAM (Salted Challenge Response Authentication Mechanism) with SHA-1, SHA-256, and SHA-512. Used for MQTT enhanced authentication. Self-contained and could be extracted for any SCRAM-based authentication need.
Provides a generic RxJS-based message queue with buffering, filtering, and sharing capabilities. Used to manage high-throughput MQTT message streams. Demonstrates reactive programming pattern for rate-limited data processing.
Implements MQTT topic wildcard matching in SQLite using recursive Common Table Expressions (CTEs). This allows efficient querying of messages by topic pattern without loading all data into memory. A non-obvious solution for implementing MQTT wildcards at the database level.
Derives text colors for MQTT topics based on WCAG 2.1 contrast guidelines. Used to assign visually distinct colors to topics in the UI. Self-contained and could be reused in any application needing accessible color assignment.