# OKF Editor — System Architecture

Tauri desktop app · React + TypeScript webview · Rust backend

### Webview / UI

- • React + TypeScript in a Tauri webview
- • CodeMirror 6 for markdown + frontmatter editing
- • Zustand for local state
- • AI Chat grounded on open bundle documents

### Architecture invariants

- • core/ is pure TS — no Tauri, no DOM. Unit-testable, portable.
- • platform/ is the ONLY module that calls invoke().
- • Token never appears in git argv — injected via askpass.

### Security

- • PAT + OpenRouter key stored in OS keychain (keyring v3)
- • Markdown preview sanitized with rehype-sanitize
- • Trunk-only publish: no branch UI exposed to users