Development & Contributing
We welcome contributions to Kairos Gateway! Whether it's reporting a bug, proposing a new feature, or submitting a Pull Request, your input is highly valued.
This guide provides instructions on how to set up the development environment, our coding standards, and how the repository is structured.
Local Setup
Prerequisites
- Rust Toolchain:
1.75.0or newer. Install via rustup. - Cargo Make (Optional but recommended):
cargo install cargo-make - Docker and Docker Compose: For running test backends and end-to-end examples.
Building the Project
The project is structured as a Cargo Workspace. To build the entire workspace:
To build just the main Gateway binary for testing:
Running Tests
We expect all core components to have a robust set of tests. To execute them:
# Run unit and integration tests across the workspace
cargo test --workspace
# Run tests mapped to specific modules (e.g. AI logic)
cargo test -p kairos-rs -- ai_service_tests
Running the Components Locally
1. Kairos Gateway
Modify the config.json at the root directory to point to your desired backends, or use one from examples/.
http://localhost:5900 by default. 2. Kairos UI (Leptos)
Working on the UI requires cargo-leptos and the WASM toolchain.
# Install toolchain and cargo-leptos
rustup target add wasm32-unknown-unknown
cargo install cargo-leptos
# Run the UI in development mode with HMR
cd crates/kairos-ui
cargo leptos serve
http://localhost:3000. Keep the gateway running in a separate terminal so the UI can draw metrics (http://localhost:5900/metrics/*). 3. Kairos CLI
Coding Guidelines
Throughout the repository, we enforce Rust best practices as defined in our internal rules. Please ensure your contributions align with the following:
- Formatting: Run
cargo fmtbefore committing. - Linting: No warnings should be thrown by Clippy.
- Error Handling: Use
thiserrorfor library error types (e.g., insidekairos-rsandkairos-client) andanyhowfor top-level binary diagnostics (kairos-gatewaymain.rs). Avoidunwrap()/expect()unless absolutely necessary in test code or impossible-to-fail scenarios. - Documentation: All public structs, traits, and functions must be documented (
///). - Asynchronous Code: We heavily rely on
tokioandactix-web. Do not write blocking code in async contexts; usetokio::task::spawn_blockingif computationally heavy tasks are necessary.
Committing and Pull Requests
- Fork the repository and create your feature branch:
git checkout -b feature/my-new-feature - Implement your changes.
- Write/update unit tests.
- Update the related
.mddocumentation indocs/srcif your change affects system configuration or user instructions. - Create a Pull Request against the
mainbranch.
Conventional Commits
We encourage using Conventional Commits format for commit messages (e.g., feat: added redis caching, fix: null pointer in ws handler, docs: updated architecture schema). This helps automatically generate accurate release notes.