Skip to content

v0.1.0 — Initial Release

Latest

Choose a tag to compare

@gyaan gyaan released this 21 Feb 12:08
· 2 commits to master since this release

What is this?

A high-performance, YAML-driven IFTTT rule engine for loyalty programmes built in Go. Events (transactions, logins, etc.) are evaluated against a DAG of configurable rules and trigger actions such as awarding reward points — with zero-downtime hot-reload.

Highlights

  • DAG evaluation with depth-first traversal and early branch pruning
  • Expression languagepayload.amount > 1000 AND payload.category == "food" compiled to AST once at startup; zero parsing at eval time
  • Formula-based actionspoints_formula: "payload.amount * 0.05" evaluated at runtime
  • Atomic hot-reload — edit configs/rules.yaml, the DAG swaps via atomic.Pointer with no downtime
  • Worker pool concurrency — 32 event goroutines, bounded queue (10k), HTTP 429 backpressure
  • Prometheus metrics — counters, histograms, queue utilisation gauge
  • Pluggable actions — implement one interface to add webhook, email, CRM, etc.

Quick start

git clone https://github.com/gyaan/fluxflow.git
cd fluxflow
CGO_ENABLED=0 go run cmd/server/main.go

curl -X POST http://localhost:8080/v1/events \
  -H 'Content-Type: application/json' \
  -d '{"type":"transaction","source":"pos-system","actor_id":"user_42","payload":{"amount":1500,"category":"food"}}'
{
  "event_id": "...",
  "scenarios_matched": ["sc_high_value_food"],
  "actions_executed": [
    { "action_id": "act_bonus_points", "type": "reward_points", "success": true, "message": "Awarded 75 points to user_42 — High-value food purchase bonus" }
  ]
}

HTTP API

Method Path Description
POST /v1/events Ingest one event (sync)
POST /v1/events/batch Ingest up to 100 events (async)
GET /v1/rules List loaded scenarios
POST /v1/rules/reload Hot-reload rules from disk
GET /healthz Liveness probe
GET /readyz Readiness probe (503 if queue >80%)
GET /metrics Prometheus metrics

What's included

  • internal/condition — tokenizer + recursive-descent parser + AST evaluator
  • internal/dag — immutable graph, DFS evaluator, YAML builder
  • internal/engine — lock-free worker pool, atomic graph swap
  • internal/action — executor interface, registry, reward_points action
  • internal/api — HTTP handlers, logging middleware (stdlib net/http, Go 1.22 routing)
  • internal/metrics — Prometheus instrumentation
  • configs/rules.yaml — example rule configuration
  • GitHub Actions CI on Go 1.22 + 1.23 with race detector, coverage, and golangci-lint

Full documentation

  • README — setup, API reference, expression language, extension guide
  • TEST.md — test inventory and manual end-to-end verification steps
  • DEEPDIVE.md — architecture, design decisions, performance analysis