hlx 1.2.0

Configuration language designed specifically for ml/ai/data systems
Documentation

HLX - The Beautiful Configuration & Data Processing System

Version Rust License

HLX is a powerful, elegant configuration and data processing system built in Rust. It combines the simplicity of configuration files with the power of a full programming language, featuring 38+ built-in operators for data manipulation, encoding, hashing, mathematical operations, and more.

✨ What Makes HLX Beautiful?

🎯 Elegant Syntax

project "MyAwesomeApp" {
    version = "1.1.9"
    environment = @env var=ENV default=development
    api_key = @base64 input=my-secret-key operation=encode
    timestamp = @timestamp
    uuid = @uuid
}

agent "DataProcessor" {
    name = "HLX Data Engine"
    capabilities = ["processing", "encoding", "hashing"]
    max_connections = @math operation=mul a=100 b=10
    hash_algorithm = "sha256"
}

🚀 38+ Powerful Operators

Basic Operations

  • @uuid - Generate unique identifiers
  • @timestamp - Current Unix timestamps
  • @now - ISO datetime strings

Data Processing

  • @base64 - Encode/decode Base64 data
  • @json - Parse/stringify JSON
  • @url - URL encoding/decoding
  • @hash - SHA256/MD5 hashing

String Manipulation

  • @string - Transform, analyze, extract text
  • @env - Environment variable access
  • @var - Global variable management

Mathematical Operations

  • @math - Arithmetic operations (add, sub, mul, div, pow)
  • @calc - Expression evaluation
  • @min, @max, @avg, @sum - Statistical functions

Control Flow

  • @if, @switch - Conditional logic
  • @and, @or, @not - Logical operations

Web Integration

  • @session, @cookie - Session management
  • @param, @header - HTTP context access

🔧 Easy Integration

use helix::{Hlx, dna::atp::value::Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut hlx = Hlx::new().await?;
    
    // Set configuration
    hlx.set("project", "name", Value::String("MyApp".to_string()));
    hlx.set("project", "version", Value::String("1.1.9".to_string()));
    
    // Increase numeric values
    let visits = hlx.increase("stats", "visits", 1.0)?;
    let page_views = hlx.increase("stats", "page_views", 5.0)?;
    
    // Generate HLX content
    let content = hlx.make()?;
    println!("{}", content);
    
    // Execute operators
    let uuid = hlx.execute_operator("@uuid", "").await?;
    let timestamp = hlx.execute_operator("@timestamp", "").await?;
    let hash = hlx.execute_operator("@hash", "input=Hello World, algorithm=sha256").await?;
    
    Ok(())
}

🎨 Real-World Examples

Configuration Management

project "WebService" {
    name = "HLX API Server"
    version = "1.1.9"
    port = @env var=PORT default=8080
    database_url = @base64 input=postgresql://user:pass@localhost/db operation=encode
    api_key_hash = @hash input=my-secret-key algorithm=sha256
    startup_time = @timestamp
    instance_id = @uuid
}

agent "Database" {
    name = "PostgreSQL Connection Pool"
    max_connections = @math operation=mul a=10 b=100
    timeout_ms = @math operation=mul a=30 b=1000
    cache_size = @math operation=pow a=2 b=10
}

Data Processing Pipeline

workflow "DataPipeline" {
    name = "ETL Processing"
    input_format = "json"
    output_format = "hlx"
    
    # Process incoming data
    processed_data = @json input={"name":"John","age":30} operation=parse
    name_upper = @string input=John operation=upper
    age_hash = @hash input=30 algorithm=md5
    
    # Generate output
    output_id = @uuid
    processed_at = @now
    data_hash = @hash input={"name":"JOHN","age":"30"} algorithm=sha256
}

Counter & Statistics Management

context "Analytics" {
    # Initialize counters
    page_views = 0
    user_registrations = 0
    api_calls = 0
    
    # Increment counters (via hlx.increase())
    # page_views = 1, 2, 3...
    # user_registrations = 1, 2, 3...
    # api_calls = 100, 150, 200...
}

context "Session" {
    # Track session metrics
    duration_minutes = 0.0
    interactions = 0
    errors = 0
    
    # Increment session data
    # duration_minutes = 15.5, 23.75...
    # interactions = 1, 2, 3...
}

Security & Validation

context "Security" {
    # Hash sensitive data
    password_hash = @hash input=user_password algorithm=sha256
    api_key_encoded = @base64 input=secret_api_key operation=encode
    
    # Validate input
    is_valid_email = @string input=user@example.com operation=length
    sanitized_input = @string input=user_input operation=trim
    
    # Generate secure tokens
    session_token = @uuid
    csrf_token = @hash input=session_data algorithm=sha256
    timestamp = @timestamp
}

🛠️ Installation

From Source

git clone https://github.com/helix/hlx.git
cd hlx
cargo build --release

Add to Your Project

[dependencies]
hlx = { path = "../hlx" }
tokio = { version = "1.0", features = ["full"] }

📚 Documentation

Operator Reference

Examples

🎯 Key Features

✅ What HLX Does Well

  • 38 Working Operators - Comprehensive data processing capabilities
  • Increase Method - Built-in counter increment functionality
  • Type Safety - Rust's type system ensures reliability
  • Async Support - Built for modern async/await patterns
  • Extensible - Easy to add custom operators
  • Fast - Rust performance with zero-cost abstractions
  • Memory Safe - No garbage collection overhead
  • Cross-Platform - Works on Linux, macOS, Windows

🔧 Operator Categories

  • Basic: UUID, timestamps, current time
  • Data: Base64, JSON, URL encoding/decoding
  • Security: SHA256/MD5 hashing, data integrity
  • Math: Arithmetic, statistical functions
  • String: Transform, analyze, extract text
  • Logic: Conditional operations, pattern matching
  • Web: Session, cookie, HTTP context
  • Variables: Global state, environment access

🚀 Performance

HLX is built for performance:

  • Zero-cost abstractions - Operator calls compile to efficient code
  • Memory efficient - No garbage collection, predictable memory usage
  • Fast execution - Rust's performance with async support
  • Scalable - Handles large configurations and data processing

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Development Setup

git clone https://github.com/helix/hlx.git
cd hlx
cargo test
cargo run --example basic_set_get

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with ❤️ using Rust
  • Inspired by modern configuration management needs
  • Designed for developer happiness and system reliability

HLX - Where Configuration Meets Power 🚀

Transform your configuration files into powerful data processing pipelines with HLX's beautiful operator system.