Skip to content

HeyAlaia/RuleEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RuleEngine

A powerful, flexible rules engine built with Java, TypeScript, and Vue. Everything is designed to make rules management simple, efficient, and scalable.

Language Composition Language Composition Language Composition License

πŸ“‹ Overview

RuleEngine is a modern rules engine framework designed for enterprise applications. It provides a flexible, dynamic way to define, manage, and execute business rules without requiring code changes or redeployment.

Key Features:

  • ✨ Dynamic Rule Definition: Define rules on-the-fly without recompilation
  • πŸš€ High Performance: Optimized execution engine for large rule sets
  • 🎨 User-Friendly UI: Vue-based frontend for intuitive rule management
  • πŸ”Œ Easy Integration: Spring Boot starter for seamless integration
  • πŸ“Š Rule Versioning: Track and manage multiple versions of rules
  • πŸ›‘οΈ Type-Safe: Strong typing with TypeScript and Java

πŸ—οΈ Architecture

RuleEngine/
β”œβ”€β”€ rule-engine-core/          # Core engine logic (Java)
β”œβ”€β”€ rule-engine-starter/       # Spring Boot starter integration (Java)
└── rule-engine-ui/            # Web UI (Vue + TypeScript)

Components

Module Language Purpose
rule-engine-core Java Core rule execution engine, parser, and evaluator
rule-engine-starter Java Spring Boot auto-configuration starter
rule-engine-ui Vue/TypeScript Web-based rule editor and management interface

πŸš€ Quick Start

Prerequisites

  • Java 8 or higher
  • Node.js 14+ (for UI development)
  • Maven 3.6+ (for building)

Installation

As a Maven Dependency

Add to your pom.xml:

<dependency>
    <groupId>com.ruleengine</groupId>
    <artifactId>rule-engine-starter</artifactId>
    <version>1.0.0</version>
</dependency>

Running the UI

cd rule-engine-ui
npm install
npm run serve

πŸ“– Usage Example

Java/Spring Boot

@SpringBootApplication
public class MyApplication {
    
    @Autowired
    private RuleEngine ruleEngine;
    
    public void executeRule(String ruleName, Map<String, Object> context) {
        RuleResult result = ruleEngine.execute(ruleName, context);
        System.out.println("Rule executed: " + result.isSuccess());
    }
}

Defining a Rule

Rules can be defined through the UI or programmatically:

{
  "name": "DiscountRule",
  "conditions": [
    {
      "field": "amount",
      "operator": "greaterThan",
      "value": 100
    }
  ],
  "actions": [
    {
      "type": "apply_discount",
      "value": 0.1
    }
  ]
}

πŸ› οΈ Development

Building the Project

# Build all modules
mvn clean install

# Build specific module
mvn clean install -pl rule-engine-core
mvn clean install -pl rule-engine-starter

Development Setup

# Clone the repository
git clone https://github.com/HeyAlaia/RuleEngine.git
cd RuleEngine

# Install dependencies
mvn install
npm install

# Run tests
mvn test

# Start development server
npm run dev

πŸ“‹ API Reference

RuleEngine Interface

public interface RuleEngine {
    RuleResult execute(String ruleName, Map<String, Object> context);
    void loadRule(String ruleName, Rule rule);
    void deleteRule(String ruleName);
    Rule getRule(String ruleName);
}

πŸ§ͺ Testing

Run the test suite:

mvn test

πŸ“ Configuration

Configure RuleEngine via application.properties or application.yml:

ruleengine.cache.enabled=true
ruleengine.cache.max-size=1000
ruleengine.execution.timeout=5000

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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

πŸ‘₯ Authors

πŸ’¬ Support

🎯 Roadmap

  • Advanced rule composition
  • Machine learning-based rule optimization
  • Rule analytics and monitoring dashboard
  • GraphQL API support
  • Kubernetes deployment templates

πŸ“š Language Composition

  • Java: 47.2% - Core engine and backend logic
  • TypeScript: 40.3% - UI application and type safety
  • Vue: 11.7% - Component framework and rendering
  • Other: 0.8% - Configuration and miscellaneous files

Made with ❀️ by the RuleEngine team

About

RuleEngine By Everything

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors