Skip to content
James Vu edited this page Dec 10, 2025 · 5 revisions

Home - Rust Rule Engine Wiki

Welcome to the Rust Rule Engine documentation wiki! This is your complete guide to building powerful rule-based systems.

πŸ“š Documentation Overview

For Beginners

Start here to get up and running quickly:

  1. Getting Started ⭐ START HERE

    • 5-minute quick start
    • Installation guide
    • Your first rule
    • Common patterns
  2. Engine Comparison & Selection

    • Choose your engine (Native, RETE-UL, Parallel)
    • Performance benchmarks
    • Decision matrix
    • When to use each
  3. GRL Syntax Guide

    • Complete rule language reference
    • Conditions (WHEN clause)
    • Actions (THEN clause)
    • Advanced examples

For Practitioners

Build sophisticated systems:

  1. Advanced Patterns & Techniques

    • Multi-stage workflows
    • Finite state machines
    • Complex aggregations
    • Rule composition
    • 10 advanced patterns
  2. Production Deployment

    • Architecture setup
    • Database integration
    • Caching layer
    • Docker deployment
    • Monitoring & observability
    • Scaling strategies
    • Security considerations

For Troubleshooting

Fix problems and optimize:

  1. Troubleshooting & FAQ
    • Common issues & solutions
    • Performance tips
    • Memory management
    • Debug checklist
    • Frequently asked questions

πŸš€ Quick Navigation

By Use Case

Building a Business Rules Engine? β†’ Getting Started β†’ GRL Syntax Guide β†’ Advanced Patterns

Need High Performance? β†’ Engine Comparison β†’ Performance Tuning

Deploying to Production? β†’ Production Deployment β†’ Monitoring

Debugging Issues? β†’ Troubleshooting & FAQ

Learning Advanced Topics? β†’ Advanced Patterns β†’ Production Deployment


🎯 Choose Your Path

Path 1: Beginner (1-2 hours)

Perfect for learning the basics:

  1. Getting Started - 10 min
  2. Engine Comparison - 15 min
  3. GRL Syntax Guide - 45 min
  4. Run examples from repository

Result: Can write simple rules and understand engines

Path 2: Intermediate (4-6 hours)

Build real applications:

  1. Complete Path 1
  2. Advanced Patterns - 45 min
  3. Production Deployment - 60 min
  4. Set up local development environment

Result: Can build production-ready systems

Path 3: Advanced (2-3 days)

Master the system:

  1. Complete Path 2
  2. Study all 60+ examples
  3. Deep dive into each engine
  4. Performance optimization
  5. Deploy to production

Result: Can architect complex rule systems


πŸ“– Key Concepts

The Four Engines

Engine Best For Speed Learn Time
Native Simple rules, plugins Good 10 min
RETE-UL 50-1000 rules Excellent 30 min
Parallel Batch processing Best 45 min
Backward Chain Goal reasoning Medium 1 hour

GRL Basics

A rule has three parts:

rule "RuleName" salience 100 no-loop {
    when                    // Conditions
        status == "active"
    then                    // Actions
        result = calculate(amount);
}

Rule Execution

  1. Match - Find facts matching conditions
  2. Fire - Execute actions
  3. Update - Update working memory
  4. Repeat - Continue until no new matches

πŸ” Feature Highlights

Native Engine

βœ… Plugin system (44+ actions)
βœ… Custom functions
βœ… GRL support
βœ… Template system
βœ… Simple API

RETE-UL Engine

βœ… High performance (10-100x faster)
βœ… Pattern matching
βœ… Incremental updates
βœ… Memory efficiency
βœ… Memoization

Advanced Features

βœ… Multi-field collections βœ… Expression evaluation βœ… Accumulate functions βœ… Backward chaining with Disjunction (OR) βœ… Truth maintenance system βœ… Proof explanations with export


πŸ’‘ Real-World Examples

E-Commerce Discounts

rule "VIPDiscount" {
    when
        customer.tier == "vip" &&
        order.amount > 500
    then
        order.discount = order.amount * 0.25;
}

See more examples β†’

Loan Approval

Multi-stage workflow checking income, credit score, and risk.
See detailed example β†’

Fraud Detection

Real-time detection of suspicious transactions.
See detailed example β†’

IoT Monitoring

Alert on sensor readings exceeding thresholds.
See detailed example β†’


πŸ› οΈ Development Environment

Minimum Requirements

  • Rust 1.70+
  • Cargo package manager

Installation

# Create new project
cargo new my-rules-app
cd my-rules-app

# Add dependency
cargo add rust-rule-engine

First Run

cargo run

Full setup guide β†’


πŸ“š Additional Resources

Repository

Code Examples

  • 60+ working examples in examples/ directory
  • Real-world use cases
  • Performance demonstrations
  • Integration patterns

Community


πŸ“Š Learning Resources

Video Tutorials

  • Introduction to Rule Engines (coming soon)
  • RETE-UL Performance Deep Dive (coming soon)
  • Production Deployment Walkthrough (coming soon)

Articles & Blog Posts

Benchmarks & Comparisons


πŸŽ“ Learning Outcomes

After studying this wiki, you'll be able to:

  • βœ… Choose appropriate engine for your use case
  • βœ… Write complex GRL rules
  • βœ… Debug rule execution
  • βœ… Optimize for performance
  • βœ… Deploy to production
  • βœ… Handle edge cases
  • βœ… Build sophisticated workflows
  • βœ… Scale to thousands of rules

🏁 Getting Started Right Now

Option 1: Quick Start (5 minutes)

  1. Read Getting Started
  2. Run first example
  3. Modify and experiment

Option 2: Deep Dive (2 hours)

  1. Read Engine Comparison
  2. Study GRL Syntax Guide
  3. Review Advanced Patterns
  4. Run and modify examples

Option 3: Production Ready (1 day)

  1. Complete Option 2
  2. Study Production Deployment
  3. Set up development environment
  4. Write and test your rules
  5. Deploy locally with Docker

πŸ“‹ Wiki Structure

Home (You are here)
β”œβ”€β”€ Getting Started
β”œβ”€β”€ Engine Comparison & Selection
β”œβ”€β”€ GRL Syntax Guide
β”œβ”€β”€ Advanced Patterns & Techniques
β”œβ”€β”€ Production Deployment
└── Troubleshooting & FAQ

⚑ Quick Reference

Common Tasks

Task Reference
Write first rule Getting Started
Choose engine Engine Comparison
Learn GRL syntax GRL Syntax Guide
Build workflows Advanced Patterns
Deploy to prod Production Deployment
Fix problems Troubleshooting & FAQ

🎯 Next Step

Ready to get started?

β†’ Go to Getting Started Guide ⭐


Last Updated: December 10, 2025 Version: 1.10.1 Status: Production Ready

Sidebar


Quick Links


How to customize

  • Edit this _Sidebar.md file in the wiki repository (or use the GitHub Wiki web editor).
  • Use wiki-style links (no .md extension), e.g. [Getting Started](01-Getting-Started).
  • To link to a section/anchor: use [#Section-Name] appended to the page name, example:
    • [See Installation](01-Getting-Started#Installation)
  • Save and push; the wiki will show the sidebar automatically.

Notes:

  • Keep entries ordered as you want them to appear.
  • You can add nested lists for subsections.
  • If you prefer a non-numbered menu, rename files and update links accordingly.

Clone this wiki locally