Introduction
Learn how to define, compile, and evaluate rules with Nodora
Nodora is a small, declarative rule language and runtime. You write rules
in a .ruleset file, compile them to a portable JSON program (NIR), and
evaluate them against an input payload. Rules can produce outputs and
emit signals that hook into your own application code.
signal SendVerificationEmail(user_id)
signal BlockAccount(user_id)
rule AccountApproval {
is_adult = input.age >= 18
allowed_country = input.country == "us" || input.country == "ca"
eligible = is_adult && allowed_country
emit SendVerificationEmail(input.user_id) when eligible && !input.email_verified
emit BlockAccount(input.user_id) when !eligible
out approved = eligible && input.email_verified
}How it works
A Nodora program goes through three stages:
- Compile — Source code is parsed, type-checked, compiled and optimized into NIR (Nodora Intermediate Representation).
- Load — The resulting NIR JSON is loaded into the evaluator.
- Evaluate — The evaluator executes a named rule against an input object, produces the declared outputs, and dispatches any emitted signals to their registered listeners.
The compiler and evaluator are decoupled. You can compile rules ahead of time and ship just the NIR JSON to any environment that can run the evaluator (Go binary, JS/WASM, etc.).