Skip to main content

Trigger Rules

The @repo/trigger-rules package provides a powerful rule engine for processing events in your Trigger.dev workflows. It allows you to define JSON-based rules that can be evaluated against event payloads to determine actions and routing.

Features

  • JSON-based rule definitions for easy configuration
  • Condition evaluation with support for complex expressions
  • Integration with Trigger.dev jobs and events
  • Dynamic rule loading and evaluation
  • Support for internationalization

Installation

This package is part of the zopio monorepo and is available to all applications in the workspace.

Basic Usage

Importing the Rule Engine

Defining Rules

Rules are defined in JSON format, either inline or loaded from a file:

Evaluating Rules

Integration with Trigger.dev

The trigger rules package integrates seamlessly with Trigger.dev jobs:

Advanced Usage

For more detailed information on using trigger rules, see the following pages:

Learn More