{"id":36598018,"url":"https://github.com/goplasmatic/datalogic-rs","last_synced_at":"2026-07-15T05:00:43.725Z","repository":{"id":263525271,"uuid":"890313886","full_name":"GoPlasmatic/datalogic-rs","owner":"GoPlasmatic","description":"A fast JSONLogic rules engine: one Rust core with official bindings for Node.js, Python, Go, Java, .NET, PHP, and the browser (WASM), plus a React visual debugger.","archived":false,"fork":false,"pushed_at":"2026-06-30T07:12:57.000Z","size":132200,"stargazers_count":73,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-07-06T10:23:53.322Z","etag":null,"topics":["business-rules","declarative-language","dotnet","expression-evaluator","feature-flags","flagd","golang","java","json","jsonlogic","nodejs","openfeature","php","policy-engine","python","rules-engine","rust","templating-engine","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://goplasmatic.github.io/datalogic-rs/playground/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoPlasmatic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-18T11:08:46.000Z","updated_at":"2026-07-06T08:15:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fb8d5a3-7c52-4f87-bf1b-82adaf48c66b","html_url":"https://github.com/GoPlasmatic/datalogic-rs","commit_stats":null,"previous_names":["open-payments/datalogic-rs","json-logic/datalogic-rs","codetiger/datalogic-rs"],"tags_count":69,"template":false,"template_full_name":null,"purl":"pkg:github/GoPlasmatic/datalogic-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoPlasmatic%2Fdatalogic-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoPlasmatic%2Fdatalogic-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoPlasmatic%2Fdatalogic-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoPlasmatic%2Fdatalogic-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoPlasmatic","download_url":"https://codeload.github.com/GoPlasmatic/datalogic-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoPlasmatic%2Fdatalogic-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35491351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business-rules","declarative-language","dotnet","expression-evaluator","feature-flags","flagd","golang","java","json","jsonlogic","nodejs","openfeature","php","policy-engine","python","rules-engine","rust","templating-engine","wasm","webassembly"],"created_at":"2026-01-12T08:33:31.835Z","updated_at":"2026-07-15T05:00:43.719Z","avatar_url":"https://github.com/GoPlasmatic.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://avatars.githubusercontent.com/u/207296579?s=200\u0026v=4\" alt=\"Plasmatic Logo\" width=\"120\" height=\"120\"\u003e\n\n# datalogic-rs\n\n**Business rules as data. One engine, every runtime.**\n\nWrite a [JSONLogic](https://jsonlogic.com) rule once and evaluate it with the exact same engine in Rust, Node.js, the browser (WASM), Python, Go, Java, .NET, and PHP. Not eight reimplementations that drift apart: one Rust core under every binding, evaluating in nanoseconds. Store rules as JSON, change pricing, eligibility, and flag logic in production, and never redeploy to do it.\n\n  [![CI](https://github.com/GoPlasmatic/datalogic-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/GoPlasmatic/datalogic-rs/actions/workflows/ci.yml)\n  [![Release](https://img.shields.io/github/v/release/GoPlasmatic/datalogic-rs?label=release)](https://github.com/GoPlasmatic/datalogic-rs/releases)\n  [![Conformance](https://img.shields.io/badge/conformance-53_suites_%2F_1,532_cases-brightgreen)](./crates/datalogic-rs/tests/suites/)\n  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n  [🚀 Try the Live Playground](https://goplasmatic.github.io/datalogic-rs/playground/) | [📖 Read the Documentation](https://goplasmatic.github.io/datalogic-rs/)\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://goplasmatic.github.io/datalogic-rs/playground/\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/GoPlasmatic/datalogic-rs/main/docs/src/assets/demo.gif\" alt=\"JSONLogic Online Debugger Demo\" width=\"800\"\u003e\n  \u003c/a\u003e\n  \u003cp\u003e\u003cem\u003eBuild, trace, and debug rules live in the \u003ca href=\"https://goplasmatic.github.io/datalogic-rs/playground/\"\u003eplayground\u003c/a\u003e.\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## Why datalogic-rs?\n\n- 🌐 **One rule, every runtime:** every binding runs the same compiled Rust core, so a rule evaluates with identical semantics on your backend, your edge workers, and your frontend. No cross-language drift, verified by a 1,532-case conformance battery in CI.\n- 🔒 **100% sandbox-safe:** evaluate user-submitted rules and formulas without arbitrary code execution. No `eval()`, no scripting runtime, no I/O; the core forbids unsafe code.\n- ⚡ **Nanosecond evaluation:** rules compile to OpCode-dispatched programs that run in a reusable memory arena: 8.9 ns geomean, 7.9× the fastest JS engine, 104.2× the reference implementation.\n- 🛠️ **Ready-made rule builder:** ship a visual editor and step-through debugger to your product dashboard with the companion React component, instead of building rule UI from scratch.\n\n---\n\n## One rule, every runtime\n\nRules are plain JSON, so there is exactly one of them, no matter how many languages you run:\n\n```yaml\nRule:   {\"and\": [{\"\u003e=\": [{\"var\": \"age\"}, 18]}, {\"==\": [{\"var\": \"status\"}, \"active\"]}]}\nData:   {\"age\": 25, \"status\": \"active\"}\nResult: true\n```\n\nThe same evaluation, one line in each runtime:\n\n| Runtime | One-shot evaluation |\n| :--- | :--- |\n| **Rust** | `datalogic_rs::eval_str(rule, data)?` |\n| **Node.js** | `apply(rule, data)` — `@goplasmatic/datalogic-node` |\n| **Browser / Edge (WASM)** | `evaluate(rule, data, false)` — `@goplasmatic/datalogic-wasm` |\n| **Python** | `apply(rule, data)` — `datalogic_py` |\n| **Go** | `datalogic.Apply(rule, data)` |\n| **Java / Kotlin** | `engine.apply(rule, data)` |\n| **.NET (C#)** | `engine.Apply(rule, data)` |\n| **PHP** | `$engine-\u003eapply($rule, $data)` |\n\nSame bytes in, same bytes out: every binding wraps the same core and passes the same 53-suite conformance battery. Each package README has the full quickstart for its language, and every binding ships the same three runnable programs under its `examples/` folder — the folders themselves are the parity demo.\n\n---\n\n## Pick your package\n\n| Language / Environment | Version | Package | Install | Guide |\n| :--- | :--- | :--- | :--- | :--- |\n| **Rust** | [![Crates.io](https://img.shields.io/crates/v/datalogic-rs.svg)](https://crates.io/crates/datalogic-rs) | `datalogic-rs` | `cargo add datalogic-rs` | [crate README](./crates/datalogic-rs/README.md) |\n| **Node.js** (native prebuilds) | [![npm](https://img.shields.io/npm/v/@goplasmatic/datalogic-node)](https://www.npmjs.com/package/@goplasmatic/datalogic-node) | `@goplasmatic/datalogic-node` | `npm i @goplasmatic/datalogic-node` | [node README](./bindings/node/README.md) |\n| **Browser, Edge, Bun, Deno** | [![npm](https://img.shields.io/npm/v/@goplasmatic/datalogic-wasm)](https://www.npmjs.com/package/@goplasmatic/datalogic-wasm) | `@goplasmatic/datalogic-wasm` | `npm i @goplasmatic/datalogic-wasm` | [wasm README](./bindings/wasm/README.md) |\n| **Python** | [![PyPI](https://img.shields.io/pypi/v/datalogic-py.svg)](https://pypi.org/project/datalogic-py/) | `datalogic-py` | `pip install datalogic-py` | [python README](./bindings/python/README.md) |\n| **Go** | [![Go Reference](https://pkg.go.dev/badge/github.com/GoPlasmatic/datalogic-rs/bindings/go/v5.svg)](https://pkg.go.dev/github.com/GoPlasmatic/datalogic-rs/bindings/go/v5) | `datalogic-go` | `go get github.com/GoPlasmatic/datalogic-rs/bindings/go/v5` | [go README](./bindings/go/README.md) |\n| **Java / JVM** (Kotlin, Scala) | first Maven release pending\u003c!-- swap for maven-central badge once published --\u003e | `io.github.goplasmatic:datalogic` | Maven / Gradle dependency | [jvm README](./bindings/jvm/README.md) |\n| **.NET** (C#, F#) | [![NuGet](https://img.shields.io/nuget/v/Goplasmatic.Datalogic.svg)](https://www.nuget.org/packages/Goplasmatic.Datalogic) | `Goplasmatic.Datalogic` | `dotnet add package Goplasmatic.Datalogic` | [dotnet README](./bindings/dotnet/README.md) |\n| **PHP** | [![Packagist](https://img.shields.io/packagist/v/goplasmatic/datalogic.svg)](https://packagist.org/packages/goplasmatic/datalogic) | `goplasmatic/datalogic` | `composer require goplasmatic/datalogic` | [php README](./bindings/php/README.md) |\n| **C / FFI** (embed anywhere) | built in-tree | `datalogic-c` | built locally | [c README](./bindings/c/README.md) |\n| **React** visual editor | [![npm](https://img.shields.io/npm/v/@goplasmatic/datalogic-ui)](https://www.npmjs.com/package/@goplasmatic/datalogic-ui) | `@goplasmatic/datalogic-ui` | `npm i @goplasmatic/datalogic-ui` | [ui README](./ui/README.md) |\n\n---\n\n## Three things you can build\n\n### 1. Dynamic business rules\n\nEncode pricing logic, fee schedules, eligibility and underwriting rules, transaction risk scoring, payment routing, access control, or form validation as JSON. Store rules in a database column, fetch them from an API, review them in a diff: logic changes ship without a deploy.\n\n```yaml\nRule:   {\"if\": [\n          {\"\u003e\": [{\"var\": \"cart.total\"}, 100]}, \"free-shipping\",\n          {\"\u003e\": [{\"var\": \"cart.total\"}, 50]},  \"flat-rate\",\n          \"standard\"\n        ]}\nData:   {\"cart\": {\"total\": 127.5}}\nResult: \"free-shipping\"\n```\n\n### 2. JSON response templates\n\nEnable templating mode and JSON key-value structures flow through to the output, with operators computing fields in place:\n\n```yaml\nTemplate: {\"greeting\": {\"cat\": [\"Hello \", {\"var\": \"name\"}]},\n           \"isAdult\":  {\"\u003e=\": [{\"var\": \"age\"}, 18]}}\nData:     {\"name\": \"Jane\", \"age\": 25}\nOutput:   {\"greeting\": \"Hello Jane\", \"isAdult\": true}\n```\n\nTemplating is an engine option in every binding (in Rust: `Engine::builder().with_templating(true)`, behind the `templating` feature).\n\n### 3. Safe user expressions\n\nLet power users and admins write formulas without handing them a scripting engine:\n\n```yaml\nRule:   {\"+\": [{\"var\": \"subtotal\"}, {\"var\": \"tax\"}, {\"var\": \"shipping\"}]}\nData:   {\"subtotal\": 100, \"tax\": 8.5, \"shipping\": 5}\nResult: 113.5\n```\n\nTry any of these live in the [playground](https://goplasmatic.github.io/datalogic-rs/playground/), or browse the [use-case cookbook](https://goplasmatic.github.io/datalogic-rs/use-cases/examples.html) for feature flags, fraud scoring, and data transformation recipes.\n\n---\n\n## 🎨 Visual rule builder and debugger\n\nFor admin portals and dashboards where non-engineers author rules, drop `@goplasmatic/datalogic-ui` into your React app. It runs the WASM core internally to compile and trace execution live, and it is the same component behind the online playground.\n\n```tsx\nimport { DataLogicEditor } from '@goplasmatic/datalogic-ui';\n\n\u003cDataLogicEditor\n  value={{ \"\u003e\": [{ \"var\": \"x\" }, 10] }}\n  data={{ x: 42 }}\n  onChange={(newRule) =\u003e console.log('Rules modified:', newRule)}\n/\u003e\n```\n\n---\n\n## One API shape, every binding\n\nEvery binding exposes the same seven patterns, so knowledge transfers across your stack:\n\n| Pattern | Shape | Use when |\n| :--- | :--- | :--- |\n| **One-shot** | `apply(rule, data)` | ad-hoc evaluation, scripts, low volume |\n| **Engine** | construct with config / custom operators | non-default semantics, extensions |\n| **Compile once** | `engine.compile(rule)` → evaluate many | one rule, many payloads |\n| **Session** | `engine.session()` | hot loops; reuses the internal arena across evaluations |\n| **Parse once** | `DataHandle(json)` → evaluate many rules against it | one payload, many rules or repeat evaluations; skips the dominant per-call parse cost |\n| **Typed** | `session.evaluateBool/Number/Truthy(rule, handle)` | predicates and scalar results; no JSON decode on the way out |\n| **Batch** | `session.evaluateBatch(rule, handles)` / `evaluateMany(rules, handle)` | many evaluations in one call, per-item errors that never fail the set |\n\nRust adds two more tiers: zero-copy evaluation into a caller-owned arena, and traced evaluation powering the visual debugger. See the [Rust crate deep-dive](./crates/datalogic-rs/README.md) for the full ladder.\n\n---\n\n## Performance\n\n\u003c!-- canonical-bench v5.0 --\u003e\nGeomean execution time across 50 benchmark suites (Apple M2 Pro; median of 3 samples; ratios are pairwise shared-suite geomeans; methodology in [`tools/benchmark/BENCHMARK.md`][bench]):\n\n```text\ndatalogic-rs (native Rust)              | 8.9 ns   (■) 1x\njson-logic-engine (JS, compiled)        | 60.3 ns  (■■■■■■) 7.9x\njson-logic-engine (JS, interpreted)     | 235.2 ns (■■■■■■■■■■■■■■■■■■■■■■■■) 30.7x\njsonlogic-rs (bestowinc Rust engine)    | 244.9 ns (■■■■■■■■■■■■■■■■■■■■■■■■) 30.6x\njson-logic-js (Reference JS library)    | 434.8 ns (■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■) 104.2x\n```\n\nRules compile to a simple AST with OpCode dispatch (no runtime string matching) and execute inside a reusable memory arena: single-digit nanoseconds for folded rules, 10-120 ns for context-dependent ones.\n\nIn Node.js, the native `@goplasmatic/datalogic-node` package is the fast path and runs close to native Rust. The WASM build trades speed for portability (901.1 ns geomean under Node, 101× native, but it runs anywhere JavaScript does). Use native on Node servers; use WASM in browsers, edge runtimes, Deno, and Bun.\n\nReproduce it yourself: `cargo run --release -p datalogic-bench --bin compare` — full matrix and caveats in [`tools/benchmark/BENCHMARK.md`][bench].\n\n[bench]: ./tools/benchmark/BENCHMARK.md\n\n---\n\n## Engine guarantees\n\n- **Conformance, enforced in CI** — passes the official JSONLogic suite plus an extended cross-binding battery: 1,532 cases across 53 suites, run against the same core every binding ships.\n- **59 built-in operators** — comparison, arithmetic, logic, strings, arrays, datetime, error handling; extensible with custom operators authored per host language.\n- **Thread-safe evaluation** — compiled `Logic` is `Send + Sync`; share it across threads via `Arc`.\n- **Zero `unsafe`** — the core engine forbids unsafe code (`#![forbid(unsafe_code)]`).\n- **Zero-copy variables** — `bumpalo`-backed evaluation; read-through operations like `var` borrow directly from the input.\n- **Serde-optional** — the default build has no `serde_json` dependency; enable the feature only for typed interop.\n- **Configurable semantics** — division-by-zero behavior, NaN handling, truthiness rules, and numeric coercions are all engine options.\n- **Verifiable supply chain** — npm packages publish from GitHub Actions with provenance attestation; check with `npm audit signatures`.\n\n### OpenFeature / flagd\n\nThe opt-in `flagd` cargo feature (enabled in every language binding) ships the `fractional` and `sem_ver` operators used by [OpenFeature flagd](https://flagd.dev) flag definitions. `fractional` implements murmurhash3 bucketing byte-compatible with the canonical Go evaluator, so users land in the same variant buckets across implementations. That makes the engine usable as an in-process, flagd-compatible feature-flag evaluator in all eight runtimes.\n\n---\n\n## Migrating from v4\n\nv5 contains breaking API updates: `DataLogic` is renamed to `Engine`, `CompiledLogic` to `Logic`, and `Operator` to `CustomOperator`. One-shot evaluation now uses `eval_str` (returning a `String`) or `eval_into::\u003cT\u003e` (for typed values). The npm WASM package moved from `@goplasmatic/datalogic` to `@goplasmatic/datalogic-wasm`. See [MIGRATION.md](./MIGRATION.md) for the step-by-step guide.\n\n---\n\n## Resources\n\n- [Documentation site](https://goplasmatic.github.io/datalogic-rs/) — operator reference, per-language guides, configuration\n- [Online playground](https://goplasmatic.github.io/datalogic-rs/playground/) — build and debug rules in your browser\n- [How it compares](https://goplasmatic.github.io/datalogic-rs/comparison.html) — vs json-logic-js, json-logic-engine, jsonlogic-rs, ZEN, CEL\n- [Rust API docs on docs.rs](https://docs.rs/datalogic-rs)\n- [JSONLogic specification](https://jsonlogic.com)\n- [Architecture overview](./ARCHITECTURE.md) · [Development guide](./DEVELOPMENT.md) · [Changelog](./CHANGELOG.md)\n\n---\n\n## Who is using datalogic-rs?\n\n- **[dataflow-rs](https://github.com/GoPlasmatic/dataflow-rs)** (Plasmatic) — workflow/rules automation engine; every route condition is a compiled datalogic rule.\n- **[datafake-rs](https://github.com/GoPlasmatic/datafake-rs)** (Plasmatic) — mock JSON data generator configured with JSONLogic expressions.\n\nRunning datalogic-rs in production? [Add your project](https://github.com/GoPlasmatic/datalogic-rs/issues/new?title=Who%27s%20using:%20) — a one-line PR or issue is enough.\n\n---\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution rules, [DEVELOPMENT.md](./DEVELOPMENT.md) for environment setup, and [ARCHITECTURE.md](./ARCHITECTURE.md) for structural diagrams. Questions and ideas are welcome in [Discussions](https://github.com/GoPlasmatic/datalogic-rs/discussions).\n\n## About Plasmatic\n\nCreated by [Plasmatic](https://github.com/GoPlasmatic), building open-source tools for financial infrastructure and data processing.\n\n## License\n\nLicensed under Apache 2.0. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoplasmatic%2Fdatalogic-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoplasmatic%2Fdatalogic-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoplasmatic%2Fdatalogic-rs/lists"}