Skip to content

BonsaiSafe, typed expressions for rules, filters, and templates.

A small expression language for pricing rules, saved filters, formula fields, and user-authored logic. JavaScript syntax, checked against your data types before it runs, and bounded when it does.

Bonsai

// Method chains on any value

" hello world ".trim().toUpperCase()

→ "HELLO WORLD"

// Null-safe defaults

user.profile.avatar ?? "default.png"

→ "default.png"

// "." is the current item

users.filter(.age >= 18).map(.name)

→ ["Alice"]

Use it where eval() would be reckless

Pricing & Eligibility

Business Rules

A pricing rule changes every quarter. With Bonsai it is a text field in your admin panel, checked against your data types when it is saved.

order.total >= freeShippingThreshold
  && customer.tier == "gold"
Search & Admin UIs

Filter Builders

Store a saved view as a string and evaluate it per row, with no custom query parser to build or maintain.

orders.filter(
  .status == "pending"
  && now() - .placedAt > days(2)
)
Notifications & Emails

Templates

Template expressions live alongside the copy, not buried in application code or a separate engine.

`Hi ${user.firstName},
  order ${order.id} ships
  ${order.shipDate.formatDate("dd MMM")}`