Getting Started
- Fork the repository on GitHub
- Clone your fork:
- Create a feature branch:
- Make your changes
- Submit a pull request
Development Setup
Prerequisites
- Rust 1.82+ (edition 2021)
- Git
Build the Workspace
Run Tests
Run Lints
Format Code
Code Standards
All contributions must meet these standards:Clippy and Formatting
- All code must pass
cargo clippywith zero warnings - All code must be formatted with
cargo fmt - All tests must pass before submitting a PR
Documentation
- Public items should have doc comments (
///) - Use clear, concise language
- Include examples where helpful
- Document error conditions and panics
Error Handling
- Use
thiserrorfor library error types - Never use
unsafewithout a// SAFETY:comment explaining the invariants - Avoid
unwrap()andexpect()in library code unless the invariant is provably guaranteed
Performance
- Avoid allocations in hot paths
- Profile before optimizing
- Use benchmarks to validate performance improvements
Rust Style
- Follow standard Rust naming conventions:
snake_casefor functions and variablesPascalCasefor types and traitsSCREAMING_SNAKE_CASEfor constants
- Use default
rustfmtsettings - Prefer explicit types over
autowhen it improves clarity
Architecture Rules
These rules are non-negotiable and must be followed:Dependency Graph
kora-corehas zero internal workspace dependencies — keep it that way- The dependency graph is strictly acyclic:
- Never introduce circular dependencies between crates
Shard-Affinity Design
- Each shard worker owns its data and I/O — no locks on the data path
- Use message passing via channels for cross-shard communication
- Store access uses
Rc<RefCell<>>(no locks) within a shard - Cross-shard communication uses
tokio::sync::mpsc+oneshot
Lock-Free Data Path
- Do not add locks to the data path
- If you need shared state, use message passing
- Follow the existing shard-affinity patterns
RESP2 Compatibility
- Do not deviate from expected RESP2 command semantics without explicit discussion
- Match Redis behavior for standard commands where applicable
Testing
All new functionality must include tests.Unit Tests
Place unit tests in#[cfg(test)] mod tests {} blocks:
Integration Tests
Place integration tests intests/ directories within each crate:
Benchmarks
Use Criterion for benchmarks inbenches/ directories:
Running Tests
Before submitting a PR, run the full test suite:Commit Messages
Use the format:type: description
Types
feat— new featurefix— bug fixrefactor— code refactoringdocs— documentation changestest— test additions or updatesperf— performance improvementschore— maintenance tasks
Examples
Best Practices
- Keep commits focused — one logical change per commit
- Summarize the “why” rather than the “what”
- Keep the first line under 72 characters
- Add details in the commit body if needed
Pull Requests
Before Submitting
-
Run the full test suite:
- Ensure all tests pass
-
Rebase on main to avoid merge conflicts:
PR Guidelines
- Keep PRs focused on a single change
- Include tests for new functionality
- Update documentation if behavior changes
- Reference any related issues (e.g., “Closes #123”)
- Provide a clear description of what the PR does and why
PR Template
Review Process
- A maintainer will review your PR
- Address any feedback or requested changes
- Once approved, your PR will be merged
Reporting Bugs
Open an issue on GitHub with:- Steps to reproduce the bug
- Expected behavior vs. actual behavior
- Kora version (or git commit hash)
- Platform (OS, architecture)
- Relevant logs or error messages
Example
Feature Requests
Open an issue with:- Clear description of the feature
- Use case or problem it solves
- Proposed API or implementation (if applicable)
Security Issues
Do not open public issues for security vulnerabilities. See SECURITY.md for responsible disclosure instructions.Code Review Checklist
Before submitting your PR, verify:- All tests pass:
cargo test --workspace - No Clippy warnings:
cargo clippy --workspace --all-targets - Code is formatted:
cargo fmt --all - Public items have doc comments
- Tests cover new functionality
- Documentation updated if behavior changed
- Commit messages follow conventions
- No circular dependencies introduced
- No locks added to data path
- RESP2 semantics preserved (if applicable)
Community Guidelines
- Be respectful and constructive
- Assume good intent
- Ask questions if something is unclear
- Help others in issues and discussions
Getting Help
If you need help contributing:- Open a discussion on GitHub
- Ask questions in your PR
- Reach out to maintainers
License
By contributing to Kora, you agree that your contributions will be licensed under the MIT License.Next Steps
- Building from Source — build and test the workspace
- Embedded Mode — use Kora as a library
- Architecture — understand the design principles