We'd be glad for you to contribute to our source code and to make this project better!
Feel free to submit a pull request or an issue, but make sure to use the templates.
It is required to follow the Language Style rules.
Files of different languages should be checked locally according to the following conventions.
Commits should be made after all checks pass or with additional clarifications.
Run cargo fmt(rustfmt) to format the code.
Run cargo clippy to lint the code.
Follow the official naming convention.
You have to install pkg-config, libssl-dev if you want to build the binary from source.
Mitosis builds on stable Rust, if you want to build it from source, here are the steps to follow:
-
Clone the repository:
git clone https://github.com/stack-rs/mitosis.git cd mitosis -
Install dependencies:
# Ubuntu/Debian sudo apt install build-essential pkg-config libssl-dev # CentOS/RHEL/Fedora sudo dnf install gcc gcc-c++ openssl-devel pkgconfig
-
Build the project:
cargo build # Or for release build cargo build --release
The resulting binary can be found in target/debug/mito (or target/release/mito for release builds).
You should set up the environment according to our Guide
-
Create a feature branch:
git checkout -b your-feature-name
-
Make your changes following the coding guidelines below
-
Test your changes:
cargo clippy --workspace cargo fmt --all
-
Update documentation if needed:
# Update user guide cd guide && mdbook build
-
Commit with descriptive messages:
git commit -m "feat(coordinator): add task priority scheduling - Implement priority queue for task scheduling - Add priority field to task submission API - Update database schema with migration Closes #123"
Before submitting a pull request:
- Format code:
cargo fmt - Fix linting issues:
cargo clippy - Run tests:
cargo test - Security audit:
cargo audit - Check documentation:
cargo doc
We follow Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changes (formatting, etc.)refactor:Code refactoring without functionality changestest:Adding or modifying testschore:Maintenance tasks, dependency updates
Examples:
feat(client): add interactive task monitoring
fix(worker): resolve memory leak in task execution
docs(api): improve SDK examples and error handling
- Unit tests: Test individual functions and modules
- Integration tests: Test API endpoints and workflows
- Documentation tests: Ensure code examples work
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_task_submission() {
// Test implementation
}
}# All tests
cargo test
# Specific test
cargo test test_task_submission
# Integration tests only
cargo test --test integration
# With output
cargo test -- --nocapture
# Using nextest (faster)
cargo nextest run- Add rustdoc comments to public APIs
- Include examples in documentation
- Document error conditions and panics
/// Submits a new task to the coordinator
///
/// # Arguments
/// * `task` - The task specification to submit
///
/// # Returns
/// Returns the UUID of the created task
///
/// # Errors
/// Returns `MitoError::Unauthorized` if user lacks permissions
///
/// # Example
/// ```rust
/// let task_id = client.submit_task(task_spec).await?;
/// ```
pub async fn submit_task(&self, task: TaskSpec) -> Result<Uuid, MitoError> {
// Implementation
}When adding new features, update:
- User guide in
guide/src/ - API documentation and examples
- Configuration file examples
- Troubleshooting guide if applicable
- Async/Await: Use async for I/O operations
- Connection Pooling: Reuse database connections
- Streaming: Use streaming for large data transfers
- Caching: Cache frequently accessed data
- Batch Operations: Group operations where possible
# CPU profiling
cargo install flamegraph
cargo flamegraph --bin mito -- coordinator
# Memory profiling
valgrind --tool=massif ./target/debug/mito coordinator- Questions: Open a Discussion
- Bug Reports: Create an Issue
- Feature Requests: Create an Issue with the "enhancement" label
Contributors are recognized in:
- Release notes and changelog
- Contributors section of documentation
- GitHub contributor graphs
Thank you for contributing to Mitosis! 🚀