OKF Editor — System Architecture

Tauri desktop app · React + TypeScript webview · Rust backend

Webview (React + TypeScript) Rust Backend (src-tauri) User markdown author App Shell file tree · lint panel · quick open Editor Pane CodeMirror · preview · form Git Panel save & publish · pull updates AI Chat doc-grounded assistant core/ bundle · lint · schema · links · graph pure TS · no Tauri platform/ invoke() wrappers · mockable only Tauri caller fs + watch read · write · notify git.rs system git · askpass IPC secrets.rs keyring v3 · PAT + AI key github.rs REST client · repo ops ai.rs SSE stream · reqwest System Git askpass injection OS Keychain macOS · Win · Linux GitHub api.github.com OpenRouter LLM gateway · BYOK invoke() child process HTTPS REST SSE Legend External Frontend Backend Security Cloud

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