ApexStore provides two main interfaces:
For development, testing, and interactive data exploration.
# Start the interactive CLI
cargo run --bin cli
# Or in release mode (faster)
cargo run --release --bin cliFeatures:
- Interactive REPL (Read-Eval-Print Loop)
- All commands: SET, GET, DELETE, SEARCH, STATS, BATCH, etc.
- Perfect for testing and debugging
- See CLI Guide for all commands
Example Session:
lsm> SET user:alice Alice Silva
✓ SET 'user:alice' executado com sucesso
lsm> GET user:alice
✓ 'user:alice' = 'Alice Silva'
lsm> SEARCH user: --prefix
✓ 1 registro(s) encontrado(s):
user:alice = Alice Silva
lsm> STATS ALL
{
"mem_records": 1,
"mem_kb": 0,
...
}
lsm> exit
👋 Encerrando LSM-Tree CLI...For production deployments with REST API access.
# Start the API server
cargo run --bin apexstore-server
# Or in release mode (recommended for production)
cargo run --release --bin apexstore-server
# With custom configuration
DATA_DIR=./data MEMTABLE_MAX_SIZE=16777216 cargo run --bin apexstore-serverFeatures:
- REST API with JSON payloads
- Actix-Web server (high performance)
- Environment-based configuration
- Production-ready with error handling
Default Server:
- URL:
http://0.0.0.0:8080 - Health Check:
curl http://localhost:8080/health
Example API Calls:
# Insert data
curl -X POST http://localhost:8080/keys \
-H "Content-Type: application/json" \
-d '{"key": "user:1", "value": "Alice"}'
# Get data
curl http://localhost:8080/keys/user:1
# Search
curl "http://localhost:8080/keys/search?q=user:&prefix=true"
# Stats
curl http://localhost:8080/stats/all# Build CLI
cargo build --bin cli
# Build server
cargo build --bin apexstore-server
# Build both
cargo build --bins# Build CLI (optimized)
cargo build --release --bin cli
# Build server (optimized)
cargo build --release --bin apexstore-server
# Run directly after building
./target/release/cli
./target/release/apexstore-server# Start server
docker-compose up -d
# View logs
docker-compose logs -f apexstore
# Stop server
docker-compose down# Build image
docker build -t apexstore:latest .
# Run server
docker run -d \
--name apexstore-server \
-p 8080:8080 \
-v apexstore-data:/data \
apexstore:latestThe CLI uses default settings optimized for development:
- Data Directory:
./.lsm_data - MemTable Size: 4KB (for quick flushes during testing)
You can modify these in src/cli/mod.rs or pass environment variables.
The server reads configuration from environment variables:
# Create .env file
cp .env.example .env
# Edit configuration
nano .env
# Start with custom config
source .env
cargo run --bin apexstore-serverKey Variables:
DATA_DIR=./.lsm_data
MEMTABLE_MAX_SIZE=16777216 # 16MB
BLOCK_CACHE_SIZE_MB=64
BLOCK_SIZE=4096
HOST=0.0.0.0
PORT=8080See Configuration Guide for all options.
# Run all tests
cargo test
# Run specific test
cargo test test_builder_basic
# Run with output
cargo test -- --nocapture
# Check code quality
cargo clippy -- -D warnings
# Format code
cargo fmtProblem: Running cargo run without --bin uses the default binary which just exits.
Solution:
# ❌ Wrong (uses default binary)
cargo run
# ✅ Correct (specify binary)
cargo run --bin apexstore-server # For API server
cargo run --bin cli # For CLI REPLProblem: Port 8080 is already occupied.
Solution 1: Stop the other process using port 8080
# Find process
lsof -i :8080
# Kill process
kill <PID>Solution 2: Use a different port
PORT=8081 cargo run --bin apexstore-serverProblem: Incompatible SSTable format from previous version or corrupted data.
Solution: Remove old data files
# Backup first (optional)
cp -r .lsm_data .lsm_data.backup
# Remove old data
rm -rf .lsm_data/*.sst
rm -rf .lsm_data/wal.log
# Restart server/CLI
cargo run --bin apexstore-serverProblem: Typo or incorrect command syntax.
Solution: Use HELP command
lsm> HELP
# Shows all available commands with syntax- README.md - Project overview and architecture
- CLI Guide - Complete CLI reference
- Configuration Guide - All configuration options
- API Documentation - REST API endpoints
- Contributing Guide - Development guidelines
- Start CLI:
cargo run --bin cli - Try commands:
SET,GET,SEARCH,STATS ALL - Import sample data:
BATCH SET examples/batch_data.txt - Explore: See CLI Guide
- Configure: Copy and edit
.env.example - Build:
cargo build --release --bin apexstore-server - Deploy: Use Docker or systemd service
- Monitor: Check
/stats/allendpoint
- Use release builds for production (10x faster)
- Monitor with
STATS ALLin CLI or/stats/allin API - Use prefix-based keys (e.g.,
user:123,product:456) for efficient searches - BATCH SET for bulk imports (faster than individual SETs)
- Docker recommended for production deployments
- 📖 Check the CLI Guide for command syntax
- 🐛 Open an issue for bugs
- 💬 Discussions for questions
- 📧 Email: netoo.elio@hotmail.com
Built with 🦀 Rust and ❤️