Overview
Rule Engine JS provides a simple, powerful API for evaluating business rules. This section documents all public APIs.Core APIs
RuleEngine
Core evaluation engine with caching and performance optimization
StatefulRuleEngine
Event-driven engine with state tracking and history
PathResolver
Safe path resolution with security features
Rule Helpers
Fluent API for building rules programmatically
Quick Start
Import Paths
ES Modules
CommonJS
TypeScript
API Categories
Engine Management
createRuleEngine(config?)- Create rule engine instanceengine.evaluateExpr(rule, context)- Evaluate ruleengine.registerOperator(name, fn)- Add custom operatorengine.getMetrics()- Get performance metrics
State Management
new StatefulRuleEngine(engine, options?)- Create stateful enginestatefulEngine.evaluate(id, rule, context)- Evaluate with statestatefulEngine.evaluateBatch(rules, context)- Batch evaluationstatefulEngine.on(event, handler)- Event listeners
Rule Building
createRuleHelpers()- Create helper factoryrules.eq(field, value)- Equality checkrules.and(...conditions)- Combine conditionsrules.validation.email(field)- Built-in validators
Utilities
pathResolver.resolve(context, path)- Resolve pathpathResolver.resolveValueOrLiteral(context, value)- Resolve or use literal
Type Definitions
All APIs have TypeScript definitions:Error Handling
All APIs throw or return structured errors:Next Steps
RuleEngine
Learn the core engine API
Rule Helpers
Build rules with fluent API
Operators
See all available operators
Examples
View practical examples
