Architecture Overview

A tour of the two parts, the Corpus Juris and the Execution Engine, and how the pieces fit.

RegelRecht has two parts: the Corpus Juris (a git-versioned body of all Dutch law) and the Execution Engine (a runtime that evaluates laws deterministically). Everything else on this page either feeds the corpus or puts the engine in front of someone. The ideas the engine implements, such as cross-law references and delegation, are explained in How RegelRecht Works.

System context

Lawmaker[Person]Drafts and publishes legislationCitizen[Person]Checks eligibility for servicesGovernment Agency[Person]Makes decisions based on lawRegelRecht[Software System]Machine-readable law platformBWB / wetten.nl[Software System]Official Dutch law publicationEdits laws, reviews interpretationsChecks eligibilityExecutes laws for decisionsSource of law textRegelRecht - System Context

Container diagram

User[Person]Editor[Container: Vue 3 / Vite]Law editing and browsingEditor API[Container: Rust / Axum]Serves the editor and corpusREST APIEngine[Container: Rust / WASM]Deterministic law executionHarvest Worker[Container: Rust]Downloads laws from BWB /CVDREnrich Worker[Container: Rust / LLM]Adds machine_readable sectionsHarvester Admin[Container: Rust]Operations API; its UI lives in theeditorPipeline API[Container: Rust / Axum]Harvest requests, status and BWBsearchCorpus Juris[Container: Git / YAML]All laws in machine-readableformatPostgreSQL[Container: Pipeline]Job queue and law statusRegelRecht[SYSTEM]Browses and edits lawsREST API callsExecutes laws (WASM)Reads and writes ruleworksProxies /api/harvest-adminProxies /api/harvestCreates traject jobsCreates jobs, reads statusCreates harvest jobs, reads statusClaims harvest jobsClaims enrichment jobsWrites harvested lawsWrites enriched lawsRegelRecht - Containers

The pipeline is mostly not a service of its own: it is the job queue in PostgreSQL plus the Rust library (packages/pipeline) that the workers, the admin API and the editor API link against to use it. The one HTTP service it ships is the small Pipeline API, which takes harvest requests and answers status and BWB search queries; the editor API reaches it through /api/harvest. Workers pull jobs from the queue; nothing pushes work to them. See Pipeline for the job lifecycle.

The TUI, the lawmaking visualization, the demo, Grafana, and the engine’s CLI build are additional surfaces over the same engine and corpus; they are omitted here to keep the container view readable. See the component docs for each.

Data flow

  1. Harvesting: the harvest worker downloads laws from BWB (wetten.nl) and converts the XML to YAML
  2. Enrichment: laws are enriched with machine-readable interpretations, by hand or through the LLM-backed enrich worker, and then validated (see Execution-First Validation)
  3. Storage: all laws live in the Corpus Juris (a git repository) as versioned YAML files
  4. Execution: the engine loads laws from the corpus and evaluates them given inputs, resolving references into other laws as it goes

Where the code lives

regelrecht/ ├── packages/ │ ├── engine/ # Execution engine (native, WASM, CLI) │ ├── law-model/ # Rust implementation of the schema contract │ ├── cel/ # Records applications and decisions in a chronicle (chronolexography) │ ├── corpus/ # Library for reading ruleworks │ ├── harvester/ # BWB / CVDR download and conversion │ ├── pipeline/ # Job queue, harvest and enrich workers │ ├── editor-api/ # Backend for the law editor │ ├── admin/ # Harvester-admin API │ ├── tui/ # Terminal dashboard │ ├── shared/ # Types and helpers used across crates │ ├── auth/ # OIDC login and role middleware │ ├── github/ # GitHub REST client │ ├── frontend-shared/ # Code shared by the Vue frontends │ ├── poc-portal/ # Password-gated portal for the PoCs │ ├── poc-napp/ # Backend of the napp PoC │ ├── poc-chronolexografie/ # Backend of the chronolexography PoC (the cell as an app, per case) │ ├── poc-assistent/ # Policy assistant for the PoCs (Node package) │ ├── arch-extract/ # Architecture explorer (developer tool) │ └── grafana/ # Provisioned dashboards ├── frontend/ # Law editor (Vue 3 + Vite) ├── frontend-lawmaking/ # Law-making process visualization ├── frontend-demo/ # The demo, engine as WASM in the browser ├── frontend-poc-*/ # The proof-of-concepts behind the portal ├── corpus-poc/ # Case corpora of the PoCs, not law in force ├── pocs/ # The PoC register ├── corpus/ # Machine-readable laws (YAML), notes, and the demo corpus ├── corpus-registry.yaml # The regulation sources the corpus library loads ├── bdd/ # Canonical BDD grammar + conformance features ├── schema/ # Law format JSON schema, one directory per version └── docs/ # Documentation site (Astro) + RFCs

Further reading

RegelRecht

An exploration into transparent, executable legislation, and one of the three projects in the starting selection of the Nederlandse Digitale Dienst.

Links

GitHub repository
How it works
Stay informed
Roadmap (Dutch)
Documentation
Research

Contact

regelrecht@minbzk.nl

Part of

Nederlandse Digitale Dienst
Ministry of Economic Affairs and Climate Policy