Skip to content

applications desktop app

Douwe de Vries edited this page Jul 2, 2026 · 2 revisions

Desktop app

Active contributors: Douwe de Vries

Purpose

The desktop app wraps the same React UI in Tauri 2 and uses native commands for local file selection, raw CSV uploads, saves, and exports. It avoids duplicating comparison logic by calling the shared backend workflows.

Directory layout

src-tauri/
├── tauri.conf.json
└── src/
    ├── main.rs
    ├── commands.rs
    ├── tests.rs
    ├── pair_order_tests.rs
    └── comparison_snapshot_tests.rs

Key abstractions

Name File Description
tauri_commands! src-tauri/src/main.rs Single macro list of registered desktop commands.
load_csv_bytes src-tauri/src/commands.rs Reads raw IPC CSV bytes plus metadata headers.
SaveDialogOutcome src-tauri/src/commands.rs Distinguishes saved vs cancelled desktop save dialogs.
export_results_to_path src-tauri/src/commands.rs Writes shared CSV export bytes to a native path.

How it works

src-tauri/src/main.rs initializes tracing, installs tauri-plugin-dialog, manages an Arc<SessionStore>, and registers all commands. frontend/src/services/tauri.ts branches to invoke(...) in Tauri mode and passes raw bytes for CSV uploads.

graph LR
    UI[React UI] --> Service[frontend/src/services/tauri.ts]
    Service --> Invoke[Tauri invoke]
    Invoke --> Commands[src-tauri/src/commands.rs]
    Commands --> Workflows[src/backend/workflow.rs]
    Commands --> Dialogs[tauri-plugin-dialog]
Loading

Integration points

Desktop commands call load_csv_workflow, run_comparison_for_session, save_pair_order_for_session, load_comparison_snapshot_for_session, and related functions from src/backend/workflow.rs. The frontend command names are centralized in frontend/src/services/tauriCommands.ts.

Entry points for modification

When adding a desktop operation, update src-tauri/src/commands.rs, add it to the tauri_commands! macro in src-tauri/src/main.rs, update frontend/src/services/tauriCommands.ts, and add Tauri tests under src-tauri/src/. Then verify the browser route equivalent in REST API if needed.

Key source files

File Purpose
src-tauri/src/main.rs Tauri bootstrap and command registration.
src-tauri/src/commands.rs Desktop command implementations.
src-tauri/tauri.conf.json Tauri build, CSP, bundle, and window config.
frontend/src/services/tauri.ts Browser/Tauri transport switch.
frontend/src/services/tauriCommands.ts Tauri command name constants.

Clone this wiki locally