Business rule engine for .NET
Business rules as JSON, compiled to delegates
Write decisions as plain JSON documents that a reviewer can diff and a UI can generate. RuleWright parses and validates them once, compiles them to expression-tree delegates, and evaluates your objects in about 100 nanoseconds a rule.
~100 nsper rule, compiled and warm
4target frameworks, net48 to net10.0
0dependencies in the core
using RuleWright.Core;
using RuleWright.Execution;
using RuleWright.Json.SystemText;
var engine = new RuleWrightBuilder()
.UseJsonReader(new SystemTextJsonReader())
.Build();
var rules = engine.LoadRuleSet(File.ReadAllText("rules.json"));
var result = engine.Evaluate(rules, checkout);
Console.WriteLine(result.Outputs["Discount"]);
What you can build
One engine class and a rule format that is pure data: a closed set of operators, no embedded code, and every document checked before it runs.
ConditionsComparisons, text, sets, regular expressions and
AND / OR / NOT groups nested as deep as you need.
Computed valuesArithmetic, text and null handling on either side of a rule, still as data.
Decision tablesGrids of inputs and outputs with first or collect hit policies.
CollectionsAny, All, None and count over order lines, tags and payments.
Execution tracesWhich rules fired and which conditions passed, failed or were never reached.
ValidationEvery problem in a document, each with a JSON pointer, ready for an editor.
Custom functionsFifteen built-in predicates, plus your own, bound when the rules load.
Rules behind an APIEvaluate, validate and hot-swap rules in an ASP.NET Core service.
Build a rule editorDiscover the whole vocabulary at run time, so a UI never hard-codes it.