Sentrie is an open-source policy enforcement engine that lets you write business rules in a dedicated language. Instead of embedding policy logic in your application code, you define rules declaratively and let Sentrie evaluate them.
Sentrie is distributed as a single binary with no external dependencies.
macOS (recommended):
brew install sentrie-sh/tap/sentrieNote: We use Homebrew Formulas instead of Casks because macOS Gatekeeper flags binaries installed via Casks, requiring workarounds. Formulas are treated as regular binaries by Gatekeeper, providing a better user experience.
macOS, Linux, and WSL2:
curl -fsSL https://sentrie.sh/install.sh | bashWindows:
irm https://sentrie.sh/install.ps1 | iexFor detailed installation instructions and platform-specific options, see the installation guide.
Create a policy file policy.sentrie:
namespace user_management
shape User {
role: string
status: string
}
policy user_access {
fact user:User
rule allow = {
yield user.role == "admin" or (user.role == "user" and user.status == "active")
}
export decision of allow
}
sentrie exec user_management/user_access/allow --facts '{"user":{"role":"admin","status":"active"}}'sentrie serveThen make a request:
curl -X POST http://localhost:7529/decision/user_management/user_access/allow \
-H "Content-Type: application/json" \
-d '{"facts":{"user":{"role":"admin","status":"active"}}}'- Getting Started - Write your first policy
- Language Reference - Complete language documentation
- CLI Reference - Command-line interface guide
- TypeScript Modules - Extend policies with JavaScript
- Running Sentrie - Production deployment guide
Licensed under the Apache License, Version 2.0. See LICENSE and LICENSE-DUAL.md for details.