approvedin-progressApache-2.0

enrahitu: the self-contained governed cell substrate

001-enrahitu-architecture

The architecture thesis and the app shell, rewritten ground-up on 2026-07-19 from the grand-refactor realignment. enrahitu is the substrate for governed cells: Encore.ts is kept as the application framework while its managed-infrastructure coupling stays severed (in-process hiqlite, CoreLedger on libSQL/Turso, rauthy inside the app image), and every app built on it is a self-contained governed cell carrying embedded identity, embedded consensus, durable state behind one decorator data layer, a non-negotiable observability contract (Prometheus /metrics + OTel), and one extracted, hash-anchored model (app-model.json, spec 020) of what it contains and what it is permitted to do. The frontend converges React-only: frontend (the user-facing SPA) plus frontend-admin (the flag-gated admin dashboard, gated on the <app>_operator role convention). Enforcement phases in behind the model (Phase A: extraction, kernel adjudication, Decision ledger; Phase B: the Rust effect tier). One Docker image plus one volume is a complete authenticated, observable, governed application. This spec owns the repo-shell units (Encore app manifest, TypeScript and test configuration, the health service) and anchors the root package; subsystems are governed by specs 002-019 and the follow-up specs this rewrite sequences. This repository is enrahitu (EnRaHiTu: Encore.ts + rauthy + hiqlite + Turso; formerly enrahi / enrahi-kit): the Encore toolchain is vendored and driven directly via napi-rs (spec 008), and the repo doubles as the template chassis the Statecraft factory stamps (spec 009).

Depends on
Establishes
  • backend/health/ (directory)
  • encore.app
  • tsconfig.json
  • vitest.config.ts
  • vitest.setup.ts
Sections
  • 001: enrahitu architecture
  • 1. Purpose
  • 2. Rewrite record
  • 3. Territory
  • 4. Behavior
  • 4.1 The governed cell
  • 4.2 Repo-shaping decisions (retained)
  • 4.3 Frontends: React-only convergence
  • 4.4 The admin dashboard and the operator role
  • 4.5 Observability: the substrate contract
  • 4.6 app-model.json and the phased seam
  • 4.7 Dependency posture
  • 4.8 Lineage
  • 5. Sequencing
  • 6. Out of scope
Source
specs/001-enrahitu-architecture/spec.md @ dc4c9237e12aas of 2026-07-21 ยท shard 8e11e886d245