Powerful Rule Engine for Complex Business Logic

Rule Engine is a modern, scalable, and flexible rule engine built with Spring Boot 3 and Java 17. Execute complex business rules with MVEL expressions, manage rules dynamically, and scale with confidence.

Rule Example

// Dynamic Rule Evaluation
POST /beasre/v1/rule-engine/evaluate
{
  "ruleName": "discount-calculator",
  "parameters": {
    "customerType": "PREMIUM",
    "orderAmount": 1000
  },
  "payload": {
    "items": [...],
    "customer": {...}
  }
}

// MVEL Expression
if (customerType == 'PREMIUM' && 
    orderAmount > 500) {
  discount = orderAmount * 0.15;
} else {
  discount = orderAmount * 0.05;
}
return discount;
                                

Why Choose Rule Engine?

Built for modern applications with enterprise-grade features

High Performance

Optimized rule execution with caching, compiled expressions, and efficient memory management.

Scalable Architecture

Horizontal scaling support, distributed caching, and microservices-ready design.

Enterprise Security

OAuth2/JWT authentication, encrypted data storage, and comprehensive security controls.

MVEL Integration

Powerful MVEL expression language for complex business logic and dynamic rule evaluation.

MongoDB Storage

Flexible document storage with automatic indexing, versioning, and backup support.

Developer Friendly

Comprehensive API documentation, extensive testing, and modern Java 17 features.

System Architecture

Layered architecture designed for maintainability and scalability

Presentation Layer
REST Controllers DTOs Validation Exception Handling
Business Layer
Services Rule Engine Manager Cache Controller Cryptography
Data Layer
Repositories MongoDB Cache Stores RSQL Queries

Quick Start Guide

Get up and running in minutes

1

Prerequisites

  • Java 17 or higher
  • MongoDB 5.0+
  • Maven 3.6+
  • Keycloak (optional)
2

Installation


# Clone the repository
git clone https://github.com/BEAS-Software-Solutions/BEASRE.git
cd beas-rule-engine

# Build the project
mvn clean install

# Run the application
mvn spring-boot:run
                        
3

Configuration


# application.yaml
spring:
  data:
    mongodb:
      host: ${MONGODB_HOST:localhost}
      database: ${MONGODB_DATABASE:beasre}

cryptography:
  key: ${CRYPTO_KEY}
  iv: ${CRYPTO_IV}
                        
4

Test the API


# Evaluate a rule
curl -X POST http://localhost:8070/beasre/v1/rule-engine/evaluate \
  -H "Content-Type: application/json" \
  -d '{
    "ruleName": "test-rule",
    "parameters": {"amount": 100},
    "payload": {"order": "12345"}
  }'
                        

REST API Reference

Comprehensive API documentation with examples

POST /beasre/v1/rule-engine/evaluate

Evaluate a rule with parameters and payload

Request Example:

{
  "ruleName": "discount-calculator",
  "parameters": {
    "customerType": "PREMIUM",
    "orderAmount": 1000
  },
  "payload": {
    "items": [
      {"id": 1, "price": 500},
      {"id": 2, "price": 500}
    ]
  }
}
                            
Response Example:

{
  "status": {
    "message": "OK",
    "status": "Validation Executed"
  },
  "response": 150.0
}
                            

Documentation

Comprehensive guides and references

User Guide

Complete user guide with examples and best practices

View Guide
API Documentation

Detailed API reference with request/response examples

View API Docs
Architecture Guide

System architecture and design patterns

View Architecture
Developer Guide

Development setup and contribution guidelines

View Dev Guide
Security Guide

Security configuration and best practices

View Security
JavaDoc

Complete JavaDoc documentation

View JavaDoc

Security Features

Enterprise-grade security for your business rules

OAuth2/JWT Authentication

Secure API access with Keycloak integration and JWT token validation.

Encrypted Data Storage

TripleDES encryption for sensitive data with configurable keys.

Role-Based Access

Fine-grained access control with user roles and permissions.

Input Validation

Comprehensive input validation and sanitization for all endpoints.

Get in Touch

Have questions or need support?

Email

contact@beassolution.com

Website

https://beassolution.com

GitHub

https://github.com/BEAS-Software-Solutions/BEASRE