CrabMQ is a high-performance, open-source MQTT broker written in Rust, designed for scalability, reliability, and safety.
It is a community-driven project maintained by OpenCorex.
Built with Rust 🦀 for modern IoT, messaging, and event-driven systems.
- ⚡ High-performance async networking (Tokio)
- 🧵 Safe concurrency with Rust
- 📡 MQTT v3.1.1 support (in progress)
- 🌲 Topic routing with wildcard support (
+,#) - 🔁 Publish / Subscribe messaging
- 🧠 Session management
- 🪵 Structured logging with
tracing - 🔐 Optional TLS & authentication (planned)
- 📦 Modular, contributor-friendly architecture
CrabMQ/
├── config/ # Configuration files (TOML)
├── src/
│ ├── broker/ # Core broker logic
│ ├── protocol/ # MQTT protocol encoding/decoding
│ ├── server/ # TCP server & connection handling
│ ├── security/ # Auth & TLS (optional)
│ ├── utils/ # Helpers (logging, config, timers)
│ ├── errors.rs # Common error handling
│ └── main.rs # Application entry point
├── examples/ # Example MQTT clients
├── tests/ # Unit & integration tests
├── scripts/ # Build & run scripts
└── README.md
- Rust (stable)
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shVerify:
rustc --version
cargo --versiongit clone https://github.com/opencorex-org/CrabMQ.git
cd CrabMQEdit the default configuration file:
config/default.tomlExample:
[broker]
host = "0.0.0.0"
port = 1883
max_connections = 10000
[logging]
level = "info"cargo buildFor production:
cargo build --releaseUsing Cargo:
cargo runWith config file:
cargo run -- --config config/default.tomlOr run the binary directly:
./target/debug/crabmq --config config/default.tomlInstall Mosquitto clients:
sudo apt install mosquitto-clientsbrew install mosquittoSubscribe:
mosquitto_sub -h localhost -p 1883 -t "test/topic"Publish:
mosquitto_pub -h localhost -p 1883 -t "test/topic" -m "Hello CrabMQ"cargo test- MQTT QoS 1 & 2
- Retained messages
- Persistent sessions
- TLS support (8883)
- Authentication & ACL
- WebSocket MQTT
- Clustering & replication
- Metrics & observability
Contributions are welcome! 🎉
Please open an issue or submit a pull request.
CrabMQ is licensed under the Apache License 2.0