Forward Chaining Engine
Priority-based rule execution with automatic re-evaluation on fact changes, events, and timer expirations. Individual rule failures don't affect the rest of the system.
Rule Engine with Complex Event Processing
Forward chaining engine with temporal pattern detection, three DSL flavors, integrated fact store, and production-ready REST/GraphQL APIs. Built on noex GenServer actors for fault-tolerant rule processing.
Everything you need for production rule processing and event correlation
Priority-based rule execution with automatic re-evaluation on fact changes, events, and timer expirations. Individual rule failures don't affect the rest of the system.
Built-in temporal patterns: sequence detection, absence monitoring, count thresholds, and numeric aggregations — all with configurable time windows and grouping.
Write rules your way: fluent builder API with full TypeScript autocomplete, tagged template literals for compact syntax, or YAML files for configuration-driven workflows.
In-memory key-value storage with segmented wildcard pattern matching. Version tracking and change notifications power automatic rule re-evaluation.
Declarative timers with human-readable durations. One-shot and repeating schedules, optional persistence, and automatic event emission on expiration.
Production-ready Fastify server with Swagger docs, SSE streaming, webhooks, and a React-based admin interface. Manage rules, facts, and events via HTTP.
Three DSL flavors for the same rule — pick the one that fits your workflow
import { Rule, onEvent, event, emit, setFact, ref }
from '@hamicek/noex-rules/dsl';
const rule = Rule.create('order-notification')
.description('Notify on high-value orders')
.priority(10)
.when(onEvent('order.created'))
.if(event('amount').gte(100))
.then(
emit('notification.send', {
orderId: ref('event.orderId'),
message: 'High-value order received',
})
)
.also(
setFact('order:${event.orderId}:notified', true)
)
.build();Detect patterns across event streams with time windows and grouping
Detect ordered events within a time window with optional strict mode and groupBy.
sequence()
.event('order.created')
.event('payment.received')
.within('15m')
.groupBy('orderId')Trigger when an expected event does not occur within the time window.
absence()
.after('order.created')
.expected('payment.received')
.within('15m')
.groupBy('orderId')Detect when event frequency exceeds a threshold within a sliding or tumbling window.
count()
.event('auth.login_failed')
.threshold(5)
.window('5m')
.groupBy('userId')Track numeric aggregations (sum, avg, min, max) over event fields in time windows.
aggregate()
.event('order.paid')
.field('amount')
.function('sum')
.threshold(10000)
.window('1h')From fraud detection to IoT — noex-rules powers event-driven business logic
Detect suspicious login patterns, unusual transaction amounts, and geographic anomalies in real-time.
Rule.create('brute-force-detection')
.when(count()
.event('auth.login_failed')
.threshold(5)
.window('5m')
.groupBy('userId'))
.then(emit('security.alert', {
type: 'brute-force',
userId: ref('trigger.groupKey'),
}))
.build();Manage payment flows with timeout handling, retry logic, and automatic escalation on failure.
Rule.create('payment-timeout')
.when(absence()
.after('order.created')
.expected('payment.received')
.within('15m')
.groupBy('orderId'))
.then(emit('order.cancel', {
orderId: ref('trigger.groupKey'),
reason: 'Payment timeout',
}))
.build();Calculate points, track tier upgrades, and trigger rewards based on customer activity patterns.
Rule.create('gold-tier-upgrade')
.when(aggregate()
.event('order.paid')
.field('amount')
.function('sum')
.threshold(10000)
.window('30d')
.groupBy('customerId'))
.then(setFact(
'customer:${trigger.groupKey}:tier', 'gold'
))
.build();Monitor sensor data streams, detect threshold breaches, and correlate events across devices.
Rule.create('device-overheat')
.when(sequence()
.event('sensor.temp_high')
.event('sensor.temp_critical')
.within('10m')
.groupBy('deviceId'))
.then(emit('alert.overheat', {
deviceId: ref('trigger.groupKey'),
severity: 'critical',
}))
.build();noex-rules vs popular JavaScript rule engines
| Feature | noex-rules | json-rules-engine | nools | node-rules | rools | zen-engine |
|---|---|---|---|---|---|---|
| Forward Chaining | Yes | Yes | Yes (Rete) | Yes | Yes | Decision tables |
| CEP / Temporal Patterns | Sequence, absence, count, aggregate | — | — | — | — | — |
| DSL | Fluent + templates | JSON only | Custom DSL | JSON only | Plain objects | DMN / FEEL |
| YAML Rule Definitions | ✓ | — | — | — | — | — |
| Fact Store with Pattern Matching | Built-in wildcards | Almanac | Working memory | — | — | — |
| Timer Management | Built-in DSL | — | — | — | — | — |
| Event Correlation | Correlation + causation IDs | — | — | — | — | — |
| Wildcard Event Subscriptions | Topic patterns | — | — | — | — | — |
| REST API | Built-in (Fastify) | — | — | — | — | — |
| SSE + Webhooks | ✓ | — | — | — | — | — |
| String Interpolation | ${expression} | — | JS in DSL | — | — | FEEL expressions |
| External Service Calls | call_service action | Custom operators | Custom functions | Custom handlers | — | Custom nodes |
| OTP Supervision | noex GenServer | — | — | — | — | — |
| Priority-based Execution | Yes | Yes | Salience | Yes | Yes | Row order |
| OpenAPI / Swagger | ✓ | — | — | — | — | — |
| Status | Active | Active | Archived | Low activity | Active | Active |
The only JS rule engine with built-in CEP: sequence detection, absence monitoring, frequency counting, and aggregate thresholds with time windows.
Fluent builder with TypeScript autocomplete, tagged template literals for quick prototyping, and YAML for configuration-driven workflows.
Wildcard pattern queries with automatic rule re-evaluation on fact changes. No separate state management needed.
Declarative timers with human-readable durations, repeat intervals, and automatic event emission on expiry.
Fastify-based HTTP layer with SSE streaming, HMAC-signed webhooks, and Swagger documentation out of the box.
Built on noex GenServer actors. If the engine crashes, the supervisor restarts it while the rest of your application continues.
Add noex-rules to your project in seconds
$ npm install @hamicek/noex-rules Love noex? Help us keep building amazing tools