Crates.io | kairos-rs |
lib.rs | kairos-rs |
version | 0.2.6 |
created_at | 2025-09-13 21:08:52.206716+00 |
updated_at | 2025-09-24 17:10:49.691559+00 |
description | A Rust library for interacting with the Kairos Api Gateway |
homepage | |
repository | |
max_upload_size | |
id | 1838123 |
size | 423,484 |
A simple HTTP gateway and reverse proxy built with Rust. Currently in early development - contributions welcome!
Kairos-rs is a production-ready HTTP gateway that:
/users/{id}
→ /users/123
)Current status: Ready for production use with comprehensive security and reliability features.
git clone https://github.com/DanielSarmiento04/kairos-rs.git
cd kairos-rs
cargo run
Server starts on http://localhost:5900
Create a config.json
file:
{
"version": 1,
"jwt_secret": "your-secret-key-here",
"rate_limit": {
"algorithm": "token_bucket",
"requests_per_second": 100,
"burst_size": 10
},
"routers": [
{
"host": "https://http.cat",
"port": 443,
"external_path": "/cats/{id}",
"internal_path": "/{id}",
"methods": ["GET"],
"auth_required": false
},
{
"host": "https://api.example.com",
"port": 443,
"external_path": "/api/secure/{id}",
"internal_path": "/v1/data/{id}",
"methods": ["GET", "POST"],
"auth_required": true
}
]
}
# Public endpoint (no auth required)
curl http://localhost:5900/cats/200
# Secure endpoint (requires JWT)
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
http://localhost:5900/api/secure/123
// Example route configuration
{
"external_path": "/api/users/{user_id}/posts/{post_id}",
"internal_path": "/users/{user_id}/posts/{post_id}"
}
// Request: GET /api/users/123/posts/456
// Forwards to: GET /users/123/posts/456
The route matcher:
┌─────────────┐ HTTP ┌─────────────┐ HTTP ┌─────────────┐
│ Client │ ────────▶ │ Kairos-rs │ ────────▶ │ Backend │
│ │ │ Gateway │ │ Service │
└─────────────┘ └─────────────┘ └─────────────┘
│
┌─────────────┐
│ Config.json │
│ Routes │
│ JWT │
│ Rate Limits │
└─────────────┘
Components:
{
"version": 1,
"jwt_secret": "your-256-bit-secret-key-here",
"rate_limit": {
"algorithm": "token_bucket",
"requests_per_second": 100,
"burst_size": 50
},
"routers": [
{
"host": "http://backend-service.com",
"port": 8080,
"external_path": "/api/v1/users/{id}",
"internal_path": "/users/{id}",
"methods": ["GET", "PUT", "DELETE"],
"auth_required": true
},
{
"host": "https://public-api.com",
"port": 443,
"external_path": "/public/status",
"internal_path": "/health",
"methods": ["GET"],
"auth_required": false
}
]
}
KAIROS_HOST=0.0.0.0 # Server bind address
KAIROS_PORT=5900 # Server port
KAIROS_CONFIG_PATH=./config.json # Config file path
RUST_LOG=info # Log level
# Run all tests (81 tests total)
cargo test
# Performance tests
cargo test performance_tests -- --nocapture
# Integration tests only
cargo test --test integration_tests
# JWT authentication tests
cargo test --test jwt_integration_test
# Rate limiting tests
cargo test rate_limit
# Circuit breaker tests
cargo test circuit_breaker
Current test coverage: 81 comprehensive tests covering:
This project has completed Phase 1 of development and is now production-ready! Here's what's planned next:
Current focus (Phase 2):
Recently completed (Phase 1):
Future phases:
See ROADMAP.md for the complete development plan.
This project needs help! Areas where contributions would be especially valuable:
Code:
Other:
# Clone and setup
git clone https://github.com/DanielSarmiento04/kairos-rs.git
cd kairos-rs
# Install dev tools
rustup component add rustfmt clippy
# Run checks
cargo fmt --check
cargo clippy
cargo test
Current code style: Uses default rustfmt with some custom lint rules. The codebase is still evolving.
Current benchmarks on M1 MacBook Pro:
Note: These are micro-benchmarks and controlled load tests. Real-world performance depends on backend service latency and network conditions.
Recently fixed:
MIT License - see LICENSE file.
This project utilizes AI assistance for:
Human Oversight: All AI suggestions are reviewed, tested, and validated by human developers before implementation. The core architecture decisions and project direction remain under human control.
We believe in transparency about development tools and methods used in open source projects.
See the prompt guidance in llm.txt for more details.
Built with these excellent Rust crates:
Status: Production ready with comprehensive security and reliability features
Maintainer: @DanielSarmiento04
Community: Issues and PRs welcome!