-
-
Notifications
You must be signed in to change notification settings - Fork 6
Contributing
Fabrício Bracht edited this page Jul 3, 2026
·
1 revision
Thank you for your interest in contributing to the MQTT platform!
- Fork the repository on GitHub
- Clone your fork locally
- Install prerequisites and verify the build:
git clone https://github.com/YOUR_USERNAME/mqtt-lib.git
cd mqtt-lib
# Rust 1.88+ and cargo-make are required
cargo install cargo-make
# Generate test certificates (needed for TLS tests)
./scripts/generate_test_certs.sh
cargo make ci-verify- Describe what you want to fix or add
- Wait for feedback from maintainers before starting large changes
-
Create a branch for your work:
git checkout -b feature/my-feature
-
Make sure the baseline passes:
cargo make ci-verify
-
Run checks frequently:
cargo check cargo clippy --all-targets --workspace -- -D warnings -W clippy::pedantic
-
Run relevant tests:
cargo test --lib --bins # Fast unit tests cargo test # All tests
-
Format code and run the pre-commit checks:
cargo fmt cargo make pre-commit
-
Run full CI verification:
cargo make ci-verify
-
Commit with a descriptive message (no prefixes, no period at end):
git commit -m "add support for topic aliases"
- Follow Rust API Guidelines
- Use
Result<T, E>for fallible operations - Prefer
&stroverStringwhen borrowing - Use descriptive names over comments
- Use
tracingfor logging, notprintln! - Keep functions focused and small
// Good: Specific error types
pub fn connect(&self, url: &str) -> Result<(), MqttError>
// Avoid: Generic errors
pub fn connect(&self, url: &str) -> Result<(), Box<dyn Error>>- Use Tokio for async runtime
- Prefer direct async/await over channels
- Use
Arc<RwLock<T>>for shared state
- Add unit tests next to the code they cover
- Add integration tests in
tests/for end-to-end behavior - Update existing tests if behavior changes
- Add a test that reproduces the bug
- Verify the fix makes the test pass
- Use property-based tests (
proptest) for protocol edge cases - Network simulation is available via
turmoil(feature-gated) - Test both success and failure paths
- Mock external dependencies where practical
When implementing MQTT features:
- Reference the MQTT v5.0 specification
- Test against multiple brokers (Mosquitto, MQTTX, etc.)
- Ensure backward compatibility with v3.1.1
-
Title: Describe what the PR does
-
Description: Include:
- What changes were made
- Why the changes are needed
- How to test the changes
- The issue being fixed, if any
-
Checklist:
-
cargo make ci-verifypasses - Tests added/updated
- Documentation updated if needed
-
-
Review: Address feedback promptly
Releases are managed by the maintainers, who:
- Update the version in the relevant
Cargo.toml - Update
CHANGELOG.md - Run the full test suite:
cargo make ci-verify - Create a git tag (
v<version>) - Publish to crates.io (Docker images are built automatically from the tag)
Include:
- Rust version (
rustc --version) - OS and version
- Steps to reproduce (a minimal reproducible example helps)
- Expected vs actual behavior
- Error messages/logs
Include:
- Use case description
- Proposed solution (if any)
- Alternatives considered
Look for issues labeled good first issue on GitHub.
- Improve wiki pages
- Add code examples
- Fix typos
- Add test coverage
- Property-based tests with proptest
- Network simulation with turmoil
- Protocol enhancements
- New transport options
- Performance improvements
By contributing, you agree that your contributions will be licensed under the same license as the project (Apache 2.0 or MIT).
- Open a GitHub issue for bugs or features
- Check existing issues before creating new ones
- Be respectful and constructive in discussions
Getting Started
Broker Guide
Client Guide
Platform Guides
CLI Reference
Development