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.95.0or newer (1.99.0recommended; required byrig-core 0.44.0). 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
Kairos Gateway maintains a comprehensive test suite of 420 automated tests (198 Rust unit/integration tests + 101 Rust doctests + 121 Vitest UI tests):
# Run all unit, integration, and doc tests across the Rust workspace (299 tests)
cargo test --workspace
# Run Rust documentation tests only (101 doctests)
cargo test --doc -p kairos-rs
# Run specific integration test suites
cargo test -p kairos-rs --test ai_service_tests
cargo test -p kairos-rs --test cache_integration_tests
cargo test -p kairos-rs --test compression_tests
cargo test -p kairos-rs --test percentile_endpoint_tests
cargo test -p kairos-rs --test transform_integration_tests
cargo test -p kairos-rs --test jwt_integration_test
cargo test -p kairos-rs --test websocket_integration_tests
# Run Frontend Vitest unit & component tests (121 tests across 14 suites)
cd frontend/kairos-ui && npm run test:unit -- --run
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 (Vue 3 + TypeScript)
The admin dashboard is a modern decoupled Single Page Application located in frontend/kairos-ui, built with Vue 3, TypeScript, and Vite 8.
Prerequisites: Node.js 18+ and npm.
cd frontend/kairos-ui
# Install dependencies
npm install
# Run the dev server with hot module replacement (HMR)
npm run dev
# Run unit tests
npm run test:unit -- --run
# Run type checks and production build
npm run build
The Vite dev server runs at http://localhost:5173 and automatically proxies /api, /health, /metrics, and /ws to the backend gateway at http://127.0.0.1:5900.
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.