The JavaScript Rules Engine allows you to model your business rules in Natural Language and Decision Table and deploy them to your JavaScript platform. This allows you to run your JavaScript version of your business rules in-proc. For example, inside the clients browser, NodeJS, … and even in offline mode.

In a couple of earlier posts we discussed how to use the REST API Client for JavaScript to execute your business logic (e.g., business rules, flow…) and return the results back to your JavaScript application. Also, we discussed how to build jQuery Validator for your forms using Business Rules. Now we want to take it one-step further in FlexRule v7.

Let's start with an example. In an AngularJS application for users registration you collect information like Country, State Name, Family and Email Address. We want to model rules to enforce the behaviours below on the client side, with no server round-trip:
1. Filters States based on the Country
2. Validates the form on Submit

Let's have a look at the application:



In this scenario, we used Decision Table to model the filtering behaviour:

Decision Table - JavaScript Rules Engine

Obviously, your rules can be as complex as you need them to be. You can have as many conditions (inputs) and actions (outputs) as you need.


In this scenario, we used Natural Language to model the validation behaviour:

Natural Language - JavaScript Rules Engine

Now your rules are all ready, let's deploy them to your AngularJS web application.


Deployment can be achieved using the publish button. Select the target platform:
Package-builder-deploy JS BRE

And then add all the logic you want to deploy to the JS platform:

Package-builder-Multiple logic - JS BRE

And press the Publish button. That's all, your JS files are ready and can be in your JavaScript application. The good news is you can use the API to build the JS files of your rules dynamically as well.

In Action

After integrating the JS files for your rules, now when you select the Country then the States field is updated:
JavaScript Rules Engine

Also, when you try to submit the form, if you leave fields empty or in an invalid state (e.g., invalid email address) you get the error messages from JS BRE notifications:
JavaScript Rules Engine

Book a Custom Demo

First or last name is too short


The JavaScript Rules Engine not only allows you to visually model the rules on the web in both Decision Table and Natural Language, but it also allows you to execute them right inside your JavaScript platform (i.e., inside browser, NodeJS…) with no server call back or round trip!

In this post, we just showed you the filtering and validation scenarios, but our JavaScript Rules engine is very powerful and allows you to use Monadic operators, functions and expressions you normally use, so you can model complex business rules without any restrictions. With this new release you can maintain one version of the business rules and run them on both the client and server side; “the single source of truth”.

Please go ahead and download the FlexRule from and have a look at the sample called JavaScript Application yourself!

To learn more please visit

Last updated June 26th, 2024 at 02:03 pm Published May 15th, 2017 at 08:54 pm