What is RuleBox?

The idea in one minute, what we will build, and how to install it.

On this page

What is RuleBox?

Business decisions tend to end up as one long method full of if and else. Every new requirement makes it harder to read and easier to break.

RuleBox lets you write each decision as a small, named rule instead. A rule reads like a sentence:

Given an applicant, when their credit score is under 580, then the result is DECLINED.

What we will build

A loan decision. We will feed it facts about an applicant and get back one answer.

Credit scoreAmount requestedDecision
540100,000DECLINED
720100,000APPROVED
720900,000MANUAL_REVIEW
640100,000MANUAL_REVIEW

Four words to know

WordMeaning
FactA piece of data a rule can look at, like creditScore.
RuleA condition (when) plus an action (then).
RuleBookA group of rules that run in order.
ResultThe answer the rules build up as they run.

Install

RuleBox is a ColdBox module. From your app's root folder:

box install rulebox

When your app starts, ColdBox registers these objects with WireBox:

WireBox IDScopeWhat it is
RuleBook@ruleboxTransientA group of rules
Rule@ruleboxTransientA single rule
Result@ruleboxTransientThe answer being built
Builder@ruleboxSingletonBuilds rules and rulebooks on the fly
RuleBookRegistry@ruleboxSingletonFinds the rulebooks you declare in config

You will use RuleBook in the next lesson and meet the registry in lesson 7.

Try it

Run box install rulebox, restart your app, and move on. There is nothing else to configure.

Planning to keep rules in YAML files? Also run box install bx-yaml. RuleBox does not install it for you. JSON and BoxLang rules need nothing extra.

Next: write your first rule.

Edit this page Download Markdown Last updated Oct 7, 2026, 10:59:26 AM
Lesson 1 of 10 - Tutorial Course