-
Notifications
You must be signed in to change notification settings - Fork 0
02. Architecture
Nicolás Baier Quezada edited this page Jun 5, 2026
·
1 revision
DIRD+ is a Tauri v2 desktop app: a Rust native shell hosting a WebView that runs the React frontend. All logic — UI, AI inference, database, encryption, LLM — runs in-process on the device. There is no server and no network dependency after the initial model download.
┌──────────────────────────── Tauri process (Rust shell) ────────────────────────────┐
│ │
│ WebView (frontend) Rust backend (src-tauri/) │
│ ┌─────────────────────────┐ ┌─────────────────────────────────┐ │
│ │ React 18 + TypeScript │ Tauri IPC │ crypto.rs Argon2id KDF │ │
│ │ Zustand stores │ ◄───commands──►│ db.rs SQLCipher (AES-256) │ │
│ │ Konva canvas │ │ llm.rs llama.cpp inference │ │
│ │ ONNX Runtime Web (WASM) │ │ models.rs custom-model registry│ │
│ │ jsPDF reports │ └─────────────────────────────────┘ │
│ └─────────────────────────┘ │
│ │
│ AI inference (ONNX) runs in the WebView via WebAssembly. │
│ The database, encryption and LLM live in the Rust backend. │
└─────────────────────────────────────────────────────────────────────────────────────┘
| Tech | Version | Role |
|---|---|---|
| React | 18.3 | UI framework |
| TypeScript | 5.7 (strict) | Static typing |
| Vite | 6 | Build + HMR |
| Tailwind CSS | 3.4 | Styling |
| Radix UI | — | Accessible primitives (Dialog, Tabs, Select, Switch, Slider) |
| React Router | 6 | SPA routing |
| Zustand | 5 | Global state (config, canvas, patient) |
| Konva / react-konva | 10 | Multi-layer annotation canvas |
| jsPDF + jspdf-autotable | 2.5 / 3.8 | Client-side PDF reports |
| i18next | 24.2 | i18n (Spanish / English) |
| Vitest + happy-dom | — | Test suite |
| Tech | Role |
|---|---|
| ONNX Runtime Web 1.23 | WebAssembly inference engine (detection + segmentation), runs in the WebView |
| OpenCV.js | Optic-disc refinement |
llama.cpp (llama-cpp-2 crate) |
Optional in-process LLM for report-prose polishing — no remote inference |
| Module | Responsibility |
|---|---|
crypto.rs |
Argon2id key derivation (OWASP 2025 params: m=64 MiB, t=3, p=4) |
db.rs |
SQLCipher (AES-256) database via rusqlite (bundled-sqlcipher-vendored-openssl); raw key passed via PRAGMA key = x'…'
|
llm.rs |
Local LLM: curated model catalog, on-demand download with progress events, per-family chat templating, in-process generation |
models.rs |
Custom-model registry under <user_data>/models/ (install / list / uninstall / set-active) |
-
Live database: SQLite + SQLCipher (encrypted at rest). Access layer in
src/lib/db-sql/(TableShim, mappers, migrator). Schema insrc-tauri/migrations/0001_init.sql. -
Legacy:
src/lib/db/contains the old Dexie/IndexedDB schema, kept only for one-time migration of pre-SQLite installs. New installs never use it. -
Export:
.dirdcontainers (ZIP, AES-256-GCM). See 06. Imports & Exports.
src/
├── components/ canvas/ patients/ upload/ reports/ settings/ onboarding/ demo/ ui/
├── lib/ ai/ analysis/ clinical-guidelines/ db-sql/ db/ export/ pdf/ classes/ api/
├── stores/ config-store, canvas-store, patient-store
├── i18n/ es / en locales
└── App.tsx router + parallel init
src-tauri/ crypto.rs, db.rs, llm.rs, models.rs, migrations/