[Media] I built “Decide” – a role and condition-based permission engine for Rust (and also JS/TS)
![[Media] I built “Decide” – a role and condition-based permission engine for Rust (and also JS/TS)](https://i.redd.it/qbwkvawz2x9f1.png)
I recently released Decide, a fast and lightweight permission engine written in Rust, with built-in support for both Rust and JavaScript/TypeScript.
It started as a small idea, but turned into something I genuinely found useful, especially because there weren’t many simple permission engines for Rust.
⚙️ What Decide does
- Role + condition based permission engine
- Supports conditions like:
user_id === resource_owner - Built in Rust (uses Rhai for condition evaluation)
- Comes with a JS/TS wrapper (using napi-rs)
- Published on Crates.io and NPM
GitHub Repo
The code is completely open to view. Visit the repository here.
An example usage is given in the code snippet. The part Decide::default() gets the role definitions from a decide.config.json file.
Why I Made It
There are a bunch of libraries for auth or RBAC in JS, but almost none in Rust. I thought, why not build a clean one that works for both?
It’s fully open-source and MIT licensed.
Would love to hear your thoughts
It's my first time posting here, and I'd love feedback. Especially around:
- Rust conventions or improvements
- Performance ideas
Thanks for reading, I hope this can help someone actually :)