# publicodes

> A declarative language for encoding public algorithm

Latest version **1.10.4** (published 2026-10-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install publicodes
pnpm add publicodes
yarn add publicodes
bun add publicodes
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.10.4 |
| Published | 2026-10-10 |
| First published | 2020-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 212 |
| Maintainers | johangirod, clemog, emilerolley, mquandalle, wiinxt |

## Links

- npm: https://www.npmjs.com/package/publicodes
- Repository: https://github.com/publicodes/publicodes
- Homepage: https://publi.codes/
- Issues: https://github.com/publicodes/publicodes/issues
- npm.io page: https://npm.io/package/publicodes

## Recent versions

- 1.10.4 (latest) — 2026-10-10
- 1.0.0-beta.15 (next) — 2021-04-21
- 1.0.0-beta.3 (beta.3) — 2020-05-26
- 1.0.0-beta.2 (beta.2) — 2020-05-25
- 1.0.0-beta.1 (beta.1) — 2020-05-25
- 1.10.3 — 2026-09-16
- 1.10.1 — 2026-02-16
- 1.9.1 — 2025-08-27
- 1.9.0 — 2025-05-23
- 1.8.5 — 2025-05-15
- 1.8.4 — 2025-05-15
- 1.8.3 — 2025-05-12
- 1.8.2 — 2025-03-20
- 1.8.1 — 2025-03-06
- 1.8.0 — 2025-03-03
- … 100 more at https://npm.io/package/publicodes/versions

## README

## Getting started

```bash
npm install publicodes
```

The library exports a default class [`Engine`](https://publi.codes/docs/api/publicodes/classes/Engine) which allows you to instantiate an publicodes interpreter with a set of publicodes rules.

```js
import Engine from 'publicodes'
import { parse as parseYaml } from 'yaml'

// We define a list of publicodes rules
const rules = `
dépenses primeur:
  somme:
    - 1.5 kg * 2€/kg    # carottes
    - 500g * 6€/kg      # champignons
    - 3 avocats * 1.5€/avocats
`
const parsedRules = parseYaml(rules)
const engine = new Engine(parsedRules)

const result = engine.evaluate('dépenses primeur')
```

[👉 Continue to the « Getting started » section](https://publi.codes/docs/tutoriel)

---
_Source: https://npm.io/package/publicodes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
