Tools: I Built a Lightweight Rule Engine for JS, C#, and Dart — Here's How It Works
Source: Dev.to
The Problem
I kept running into the same pattern across different projects: events happen, some conditions need to be checked, and based on those conditions, certain actions should execute. Authentication flows, game mechanics, IoT automation, e-commerce logic — they all follow this pattern. Most rule engines I found were either too heavy for what I needed or locked into a single language. So I built my own. What is ARE?
ARE (Action Rule Event) is a lightweight, dependency-free rule engine. The concept is straightforward: Events — Things that happen (user logs in, temperature changes, order placed)
Rules — Conditions to evaluate (if temperature > 30, if order total > 100)
Actions — What to execute when conditions are met (send notification, apply discount)
The pipeline: Event → Middleware → Condition Evaluation → Rule Matching → Action Execution Multi-Platform
I wanted this to work wherever I work, so ARE is available on three platforms: JavaScript/TypeScript → npm
C# / .NET → NuGet
Dart / Flutter → pub.dev
Same API design across all three. If you know one, you know them all. The Playground
Documentation is fine, but I wanted people to actually feel how the engine works. So I built an interactive playground with three real-world scenarios: 🎮 RPG Game — Combat rules, loot drops, zone effects, boss battles
🏠 Smart Home — Sensor events, schedules, energy management, security
🛒 E-Commerce — Order processing, inventory alerts, customer rewards Each scenario comes with pre-configured events, rules, and actions. You fire an event and watch the engine process it in real time. Features I'm proud of:
Rule Flow Diagram — An animated pipeline showing each stage of processing Rule Debugger — Expand any rule to see a condition-by-condition breakdown: what field was checked, what operator was used, what was expected vs. actual, and whether it passed or failed Relationship Graph — A visual map showing how events connect to rules and rules connect to actions. Hover over any node and see its connections highlighted Interactive Tutorial — A guided tour for first-time visitors that walks through every panel Full CRUD — Add, edit, or delete events, rules, and actions on the fly. Create your own scenarios without writing code Code Sandbox — Write your own ARE logic from scratch with a Monaco editor 🔗 Try it: are-playground.netlify.app Tech Stack
React 19 + TypeScript
Vite
Tailwind CSS v4
Zustand for state management
Framer Motion for animations
i18next (English + Turkish)
What's Next
I'm looking for feedback. If you try the playground, I'd love to know: Is the event → rule → action concept clear?
What use cases would you apply this to?
What's missing that would make this useful for your projects?
GitHub: github.com/BeratARPA/ARE Thanks for reading. Happy to answer any questions. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse