Rules Engine
summary
A rule-based discount engine replaces ad hoc ifs with a compiled in-memory rules session that evaluates order facts and emits discount facts (cashback, free delivery, promo codes) that the checkout applies. It is implemented with Clara Rules on Clojure, an admin JSON DSL that generates rules, Kafka to push rule updates, and live sessions swapped on config change. The system runs per-checkout at real load (2000 rps, 20k orders/day), with negligible latency in practice, and only minor UX issues around confusing hint text.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:07E-commerce discount problems
- 5:48What is a rules engine
- 8:17Facts in rules engine
- 10:03Rules syntax and structure
- 14:20Data aggregation in rules
- 16:52Cashback rule example
- 19:01Rule time constraints
- 20:50Discount rules engine usage
- 24:43Product page discount hints
- 26:09Admin panel setup
- 30:50Rules engine architecture
- 32:38Implementation results
- 34:49Hint problems and solutions
- 36:15Why it succeeded
- 37:41Resources
- 38:01Q&A








