@ruleforge/ruleforge

0.2.0 • Public • Published

RuleForge

A library for adding a rules engine to your web app

GitHub last commit GitHub issues GitHub package.json version (branch) GitHub contributors GitHub forks GitHub watchers GitHub Repo stars GitHub Sponsors GitHub

Create a rules engine for your app in minutes, that would take days to create from scratch.

Add complex rules to your web app quickly via simple commands to RuleForge's classes.

Features

  • A ready-built structure for organising your rules
  • An efficient engine for processing rules at scale
  • A simple structure that can be picked up easily
  • Create simple rulesets quickly via chaining with the RuleForge class
  • Fire actions from passed rules immediately, or en masse when you want to

Installation

RuleForge can be installed via Node Package Manager (NPM).

npm install @ruleforge/ruleforge

Documentation

Documentation can be found on the RuleForge GitHub Pages site here

Getting Started

A getting started guide will be added here soon, but in the meantime check out the example.ts and example2.ts files for two ways to get started.

There are a few different building blocks that make up RuleForge's rule engine. These are the five you will use, and what they are for:

  • Fact: An object you pass with your own properties to check your rules against.
  • Condition: An individual check you make on the Fact.
  • Rules: Contain the Conditions that must all be met for the Rule to pass.
  • Actions: The function you want to run when the Rule passes.
  • Ruleset: A container for your Rules.
  • RuleForge: A class that allows your rulesets to be created via chaining (see example2.ts)

In short:

  1. Create a ruleset.
  2. Create a rule in the ruleset.
  3. Create an action in the rule.
  4. Add conditions to the rule.
  5. Repeat 2-4 until you have all the rules you need.
  6. Create a fact, with the data you'll be checking your rules against.
  7. Run the fact through the ruleset.

Development

Want to contribute? Great!

We develop with GitHub

We use GitHub to host the code, track issues and feature requests, as well as accept pull requests.

  1. Fork the repository and create your own branch from main.
  2. Make sure your code lints.
  3. Issue that pull request!

Any contributions you make will be under the MIT Software Licence

In short, when you submit code changes, your submissions are understood to be under the same MIT License that covers the project.

Write bugs using GitHub's issues

We use GitHub issues to track public bugs. Report a bug by opening an issue.

License

MIT

Package Sidebar

Install

npm i @ruleforge/ruleforge

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

42.8 kB

Total Files

6

Last publish

Collaborators

  • jelleebeen