Show HN: Lemma – A declarative language for business rules

benrogmans1 pts0 comments

Lemma - Home

Latest release

Lemma v0.9.4

Install Lemma

Star on GitHub

Open source, Apache 2.0

LemmaBase

Manage business rules with your team

Write, review, and version your business rules together in one place.

Explore LemmaBase

(opens in new tab)

*]:pointer-events-auto">

We can't find the internet

Reconnecting to LemmaBase.com...

Something went wrong!

Reconnecting to LemmaBase.com...

Switch to dark mode

Switch to light mode

Lemma v0.9.4

Lemma v0.9.3

Lemma v0.9.2

Lemma v0.9.1

Lemma v0.9.0

Lemma v0.8.22

Lemma v0.8.21

Lemma v0.8.20

A declarative language for business rules

Lemma is a pure, declarative and open source programming language for business rules, that is easy to read for non-technical stakeholders. Rules are written in Specs that humans can read and systems can evaluate precisely and deterministically. Lemma validates Rules before they can be evaluated. Errors are impossible: Rules return a value or Veto, and optionally an explanation when you ask for one (--explain / explain: true).

spec pricing 2026-01-01<br>"""<br>Applies a tiered discount and VAT to the base price,<br>effective from 2026-01-01.<br>"""

data base_price: 100<br>data is_member: false<br>data quantity: number

rule discount: 0%<br>unless quantity >= 10 then 10%<br>unless quantity >= 50 then 15%<br>unless is_member then 20%

rule discount_amount: base_price * discount<br>rule discounted_price: base_price - discount_amount

rule vat: discounted_price * 21%<br>rule total: discounted_price + vat

Get started

If you have Cargo installed, you can run:

cargo install lemma

If you are using npm:

npm install -g lemma

Precompiled binaries for Linux, macOS, and Windows are included in the npm package automatically. Docker images are also available. See Installation for all options.

Writing your first Spec

Write a .lemma file and run it. The Learn guide walks you through everything from your first Spec to composing Rules across time and registries. You'll be productive in minute.

Documentation

Learn — guided path from first spec to composing specs

Reference — operators, types, syntax, CLI, registry, test coverage, benchmarks

Tools & SDKs — Rust, Elixir, JavaScript/TypeScript, and more

Community — contributing and publishing specs

LLMs.txt — authoring Lemma from business logic

Latest release

Lemma v0.9.4

Install Lemma

Star on GitHub

Open source, Apache 2.0

LemmaBase

Manage business rules with your team

Write, review, and version your business rules together in one place.

Explore LemmaBase

(opens in new tab)

lemma rules business lemmabase rule install

Related Articles