RuleForge
Inspiration
Businesses rely on rules for things like discounts, refunds, shipping, employee permissions, and approvals. The problem is that these rules are often spread across documents, spreadsheets, and code. This can lead to conflicting rules, unexpected edge cases, and decisions that are difficult to explain.
I wanted to build a tool that could make business rules easier to create, understand, and test. Instead of waiting for a customer to find a mistake, RuleForge can detect problems before the rules are used in a real system.
What it does
RuleForge is a visual business-logic platform that allows users to create and test decision rules.
Users can:
- define typed inputs such as numbers, text, dates, and true-or-false values;
- create rules with conditions, priorities, and actions;
- simulate different scenarios;
- view a step-by-step explanation of which rules ran;
- detect conflicting, duplicate, impossible, or unreachable rules;
- generate boundary and pairwise test cases;
- save expected results for regression testing;
- export rules as JSON, Python, or JavaScript.
For example, a business could create rules for free shipping, employee discounts, restricted products, and coupon codes. RuleForge can then identify situations where two rules produce different discounts for the same customer.
How I built it
RuleForge uses a FastAPI backend and SQLAlchemy for project storage.
The core rule engine is deterministic, meaning the same inputs always produce the same result. The engine evaluates each rule in priority order, checks its conditions, applies its actions, and records every step in an execution trace.
The static analyzer checks for problems such as:
- overlapping rules with conflicting outcomes;
- impossible conditions;
- missing input fields;
- duplicate rules;
- circular dependencies;
- unreachable logic.
I also created a test generator that uses input types and rule boundaries to produce edge cases automatically. For example, if a rule activates when an order total is at least $50, RuleForge can generate tests for values below, equal to, and above $50.
The frontend was built with HTML, CSS, and JavaScript. It includes responsive layouts, keyboard navigation, visible focus indicators, screen-reader labels, light and dark themes, and reduced-motion support.
The project also includes Docker configuration, deployment files, technical documentation, and automated tests for the API, engine, analyzer, exports, accessibility features, and edge cases.
Challenges I faced
One of the hardest challenges was creating a rule format that was flexible but still predictable. Rules needed to support different input types, priorities, nested conditions, actions, and exceptions without becoming too difficult to understand.
Another challenge was conflict detection. Two rules may look different but still apply to the same scenario and produce contradictory results. I had to compare their conditions and determine whether their valid input ranges could overlap.
Generating useful tests was also difficult because testing every possible input combination would grow too quickly. I used bounded boundary and pairwise test generation to cover important combinations without creating an unreasonable number of test cases.
I also had to make sure that exported Python and JavaScript behaved the same way as the original RuleForge engine. This required testing the generated code instead of only checking that it looked correct.
Finally, performance was a challenge on slower hardware. I kept the core modules separated and designed the test generation so it would remain bounded instead of creating unlimited combinations.
What I learned
This project taught me how interpreters process structured rules and how graph algorithms can be used to detect dependency cycles.
I also learned more about:
- API design with FastAPI;
- database models with SQLAlchemy;
- static analysis;
- regression testing;
- combinatorial test generation;
- code generation;
- accessible interface design;
- organizing a larger project into independent modules.
The biggest lesson I learned was that technical complexity is not only about adding more features. A strong system also needs predictable behavior, clear explanations, testing, documentation, and a user flow that people can understand.
What is next
Future versions of RuleForge could include natural-language policy importing, shared team projects, rule version history, audit logs, additional export languages, and integrations with existing business software.
Log in or sign up for Devpost to join the conversation.