Thank you for your interest in contributing to AimDB! This document provides guidelines and information for contributors.
AimDB is an async, in-memory database designed for data synchronization across MCU → edge → cloud environments, targeting <50ms reactivity. The project is built in Rust and supports multiple platform targets from embedded microcontrollers to cloud deployments.
- Rust: Latest stable version (2021 edition)
- Git: For version control
- Make: For build automation
- Docker: For running integration tests (optional)
-
Clone the repository:
git clone https://github.com/aimdb-dev/aimdb.git cd aimdb -
Quick development check:
make check # Runs fmt + clippy + test -
Build the project:
make build # Build with all features -
Run tests:
make test # Run all tests
make help- Show all available commandsmake check- Quick dev checks (fmt + clippy + test)make build- Build with all featuresmake test- Run all testsmake fmt- Format codemake clippy- Run linter with strict settingsmake doc- Generate and open documentationmake clean- Clean build artifacts
AimDB uses cargo deny for dependency auditing:
cargo deny check # Full audit (advisories, licenses, bans)
cargo deny check licenses # License compliance only
cargo deny check advisories # Security advisories only- Edition: Rust 2021
- Error Handling: Use
DbResult<T>withDbErrorenum - Async: All operations must be async/await compatible
- Testing: Use
tokio-testfor async test utilities - Documentation: Include examples in doc comments for public APIs
When implementing modules, follow this structure:
//! Module-level docs explaining purpose and integration points
use crate::{DbError, DbResult}; // Consistent error handling
use tracing::{debug, info, warn, error}; // Observability
/// Public API with comprehensive docs and examples
pub struct ComponentName {
// Implementation
}
impl ComponentName {
/// Constructor with error handling
pub fn new() -> DbResult<Self> {
// Implementation
}
/// Async methods for all operations
pub async fn process(&self) -> DbResult<()> {
// Implementation with tracing
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_functionality() {
// Test implementation
}
}- Target <50ms latency for data operations
- Use lock-free data structures where possible
- Minimize allocations in hot paths
- Design for zero-copy operations
- Domain-specific names:
stream_handlernothandler - Channel endpoints:
_tx/_rxsuffixes - Buffers:
_bufsuffix - Configuration:
Configsuffix
When adding dependencies, organize with feature flags:
[features]
default = ["tokio-runtime"]
tokio-runtime = ["tokio"]
embassy-runtime = ["embassy-executor"]
mqtt = ["rumqttc"]
kafka = ["rdkafka"]
embedded = ["no-std-compat"]# All tests with all features
make test
# Embedded target cross-compilation check
make test-embedded
# Specific test
cargo test test_name --features tokio-runtime- All public APIs must have tests
- Use
tokio-testfor async test utilities - Include integration tests for cross-module functionality
- Test both success and error paths
- All public APIs must have documentation with examples
- Use
///for public item documentation - Use
//!for module-level documentation - Include code examples in doc comments
- Generate docs with:
make doc
-
Run the check command:
make check # This runs fmt + clippy + test -
Ensure all tests pass:
make test -
Check license compliance:
cargo deny check # Verify dependencies meet license requirements -
Check documentation:
make doc
- Clone the repository and create a feature branch
- Make your changes following the code standards above
- Add tests for new functionality
- Update documentation as needed
- Run
make checkto ensure code quality - Submit a pull request using our PR template
Use clear, descriptive commit messages:
add async stream handler for data sync
Implements bidirectional streaming between embedded and cloud layers
## Project Structure
aimdb-core/ # Core database engine
aimdb-executor/ # Runtime trait abstractions
aimdb-tokio-adapter/ # Tokio runtime adapter
aimdb-embassy-adapter/ # Embassy runtime adapter (embedded)
aimdb-mqtt-connector/ # MQTT protocol connector
tools/aimdb-cli/ # Command-line interface (skeleton)
examples/ # Demo applications
## Next Development Areas
See `.github/copilot-instructions.md` for current implementation status and priorities:
- **Kafka Connector** - Kafka integration using `rdkafka`
- **DDS Connector** - DDS protocol support
- **CLI Tools** - Introspection, monitoring, debugging commands
- **Performance** - Benchmarks and profiling infrastructure
## Getting Help
- **Issues**: Use GitHub issues for bug reports and feature requests
- **Discussions**: Use GitHub discussions for general questions
- **Code Review**: All PRs require review before merging
## License Compliance
### Dependency Licensing
AimDB follows a permissive licensing strategy compatible with commercial use. The project accepts dependencies with these licenses:
- **Primary**: MIT, Apache-2.0 (preferred for new dependencies)
- **Compatible**: BSD-2-Clause, BSD-3-Clause, ISC
- **Unicode Data**: Unicode-3.0, Unicode-DFS-2016 (for Unicode processing crates)
### Adding Dependencies
Before adding new dependencies:
1. **Check the license** with `cargo deny check`
2. **Ensure compatibility** with our allowed licenses in `deny.toml`
3. **Avoid copyleft licenses** (GPL, LGPL, etc.) that could restrict commercial use
4. **Document the rationale** for any new license additions in your PR
If you need to add a dependency with a new license:
- Verify it's OSI-approved and business-friendly
- Update `deny.toml` to include the new license
- Explain the necessity in your PR description
### License Audit
Run license checks as part of development:
```bash
cargo deny check licenses # Check license compliance
make check # Includes all development checks
Please be respectful and constructive in all interactions. We're building this project together and want everyone to feel welcome to contribute.
By contributing to AimDB, you agree that your contributions will be licensed under the same license as the project.