Skip to content

JJairo-16/TinyRuleKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyRuleKit

Java Maven JUnit 5 License

TinyRuleKit is a small Java framework for compiling JSON rule definitions into in-memory executable rules. Rule conditions and actions are resolved once during engine construction, then cached by trigger for fast runtime execution.

The framework is designed for projects that need simple, flexible, and fast rule engines without tying domain logic to a heavy weight rules platform. Rules stay in JSON, while conditions and actions are compiled into normal Java functions.

Highlights

  • JSON rule definitions using enum names directly for triggers, conditions, and actions.
  • One-time precompilation of rules into executable conditions and actions.
  • Trigger-indexed rule cache for runtime execution over only the relevant rules.
  • Trigger guards for trigger-wide early returns before matching rules run.
  • Reusable condition definitions with ref and !ref, resolved during build.
  • Advanced JSON operators including all, any, not, !type, !all, !any, and restricted static type shorthand.
  • Practical builder API for configuring resolvers, expressions, and expression security.
  • Optional expression layer: static rules do not require MVEL, and projects can plug in another expression engine.
  • Expression security defaults with consumer-extensible policies, validators, and safe object views.
  • JSON-level required tokens for early capability checks during precompilation.
  • Loader format hints for simple arrays or metadata-rich documents.
  • JUnit 5 test suite.

Repository Layout

  • tinyrulekit: Maven project for the library artifact.
  • docs: user guide and framework documentation.
  • tinyrulekit/src/main/java/org/tinyrulekit/api: public extension points and rule runtime contracts.
  • tinyrulekit/src/main/java/org/tinyrulekit/core: rule engine entry point.
  • tinyrulekit/src/main/java/org/tinyrulekit/definition: JSON-facing rule definition records.
  • tinyrulekit/src/main/java/org/tinyrulekit/expression: expression compilation and security validation.

Example code currently lives under the test sources as fixtures: org.tinyrulekit.examples.game.

Documentation

Start with the published documentation, then follow the guide in order if you are new to the framework.

A plain Markdown copy is available under local-docs for local reading.

Download the current release from TinyRuleKit v1.0.0.

Maven Coordinates

<dependency>
    <groupId>org.tinyrulekit</groupId>
    <artifactId>tinyrulekit</artifactId>
    <version>1.0.0</version>
</dependency>

JAR Usage

TinyRuleKit is consumed as a JAR. Maven and Gradle users should add the library dependency and let the build tool resolve transitive dependencies.

Applications that load JARs manually must place tinyrulekit-1.0.0.jar, and gson-2.10.1.jar on the classpath.

MVEL is optional. Add org.mvel:mvel2 only when using the default expression engine. Static rules and custom expression engines do not require it.

Contributing

cd tinyrulekit
mvn clean test

The repository includes a local helper script, build-jar.bat, for generating the library JAR from source during development. It is intentionally ignored by Git.

License

This project is licensed under the MIT License.

Author: Jairo Linares.

About

TinyRuleKit is a lightweight Java rule engine framework that compiles JSON rules into fast, immutable, trigger-indexed runtime engines.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages