Rust-based messaging server with RocksDB storage and REST API.
First time setting up? See our comprehensive setup guides:
- 📘 Development Setup Guide - Complete installation for Windows/macOS/Linux
- 🚀 Quick Start - Get running in 10 minutes
Requirements:
- Rust 1.75 or later
- LLVM/Clang (required for RocksDB compilation)
- C++ Compiler (Visual Studio Build Tools on Windows, Xcode CLI on macOS, build-essential on Linux)
cd backend
cargo buildNote: First build takes 10-20 minutes as it compiles RocksDB, Arrow, and Parquet from source.
Known Issue: If you encounter chrono/arrow-arith compilation errors, see KNOWN_ISSUES.md for the fix.
Copy the example configuration and customize it:
cp server.example.toml server.toml
# Edit server.toml with your settingscargo runThe server will start on http://127.0.0.1:8080 by default.
Create users with auto-generated API keys for secure access:
# Create a user with API key
cargo run --bin kalamdb-server -- create-user --name "demo-user" --role "user"
# Output:
# ✅ User created successfully!
# API Key: 550e8400-e29b-41d4-a716-446655440000Use the API key with the X-API-KEY header:
curl -X POST http://localhost:8080/sql \
-H "Content-Type: application/json" \
-H "X-API-KEY: 550e8400-e29b-41d4-a716-446655440000" \
-d '{"query": "SELECT * FROM todos"}'Note: Localhost (127.0.0.1) connections bypass API key requirement for development convenience.
User table rows are now soft-deleted (marked as deleted) instead of being physically removed:
-- Delete row (soft delete)
DELETE FROM my_table WHERE id = 5;
-- Row is hidden from SELECT queries
SELECT * FROM my_table; -- Won't show id=5
-- Admin can view deleted rows (future feature)
SELECT * FROM my_table INCLUDE DELETED;Benefits:
- Data recovery capability
- Audit trail preservation
- Safer than hard delete
Deploy KalamDB in a production-ready Docker container:
cd docker/build
docker build -f Dockerfile -t jamals86/kalamdb:latest ../..
cd ../run/single
docker-compose up -dSee docker/README.md for complete deployment guide.
Override any server.toml setting with environment variables:
KALAMDB_SERVER_PORT=9000 \
KALAMDB_LOG_LEVEL=debug \
cargo runFormat: KALAMDB_ + uppercase path with _ separator
KALAMDB_SERVER_PORT→[server].portKALAMDB_LOG_LEVEL→[logging].levelKALAMDB_DATA_DIR→[storage].data_dir
KalamDB provides official SDKs for multiple languages in link/sdks/:
TypeScript/JavaScript SDK (link/sdks/typescript/):
- 📦 Published as
kalam-linkon npm - 🔧 37 KB WASM module with full TypeScript types
- ✅ 14 passing tests, comprehensive API documentation
- 🌐 Works in browsers and Node.js
Usage in Examples:
{
"dependencies": {
"kalam-link": "file:../../link/sdks/typescript"
}
}Important: Examples MUST use SDKs as dependencies, not create mock implementations. See SDK Integration Guide for architecture details.
See link/README.md for complete SDK documentation.
backend/
├── Cargo.toml # Workspace configuration
├── server.example.toml # Example configuration
├── crates/
│ ├── kalamdb-core/ # Core storage library
│ ├── kalamdb-api/ # REST API library
│ └── kalamdb-server/ # Main server binary
└── tests/ # Integration tests
# Run all tests
cargo test
# Run specific test
cargo test test_message_storage
# Run integration tests only
cargo test --test '*'
# Run with output
cargo test -- --nocapture# Check for errors
cargo check
# Run clippy (linter)
cargo clippy
# Format code
cargo fmt
# Build optimized release
cargo build --releaseSee server.example.toml for all available configuration options:
- Server: Host, port, worker threads
- Storage: RocksDB path, WAL settings, compression
- Limits: Message size, query limits
- Logging: Log level, file path, format
- Performance: Timeouts, connection limits
Insert a new message
Request:
{
"conversation_id": "conv_123",
"from": "user_alice",
"content": "Hello, world!",
"metadata": {"role": "user"}
}Response:
{
"msg_id": 1234567890,
"status": "stored"
}Query messages
Request:
{
"conversation_id": "conv_123",
"limit": 50
}Response:
{
"messages": [...],
"count": 50,
"has_more": false
}Health check endpoint
Response:
{
"status": "healthy",
"version": "0.1.0"
}Logs are written to the path specified in server.toml (default: ./logs/app.log).
Log levels: error, warn, info, debug, trace
To change log level:
[logging]
level = "debug"- kalamdb-core: Core storage engine with RocksDB wrapper, message models, and ID generation
- kalamdb-api: REST API handlers and routes using Actix-web
- kalamdb-server: Main binary that ties everything together
Phase 1 Complete: Project structure and dependencies set up ✅
Phase 2 Next: Implement foundational components (config, logging, models, storage)
See specs/001-build-a-rust/tasks.md for the complete task list.
If you encounter compilation errors with arrow-arith and chrono::quarter(), this has been fixed by pinning chrono to 0.4.39.
Verification:
# PowerShell (Windows)
pwsh -File scripts/verify-chrono-version.ps1
# Bash (Linux/macOS)
bash scripts/verify-chrono-version.shFor details, see KNOWN_ISSUES.md.
MIT OR Apache-2.0