Skip to content

applications desktop app

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

Desktop App

Active contributors: Douwe de Vries

The desktop app is a Tauri 2 wrapper around the same React frontend and Rust backend workflows used by the local web app. /Users/vriesd/projects/csv-align/src-tauri/src/main.rs initializes tracing_subscriber, installs the dialog plugin, manages an Arc<SessionStore>, and registers every public command through tauri::generate_handler![...].

Desktop mode does not call the Axum server. The frontend detects Tauri in /Users/vriesd/projects/csv-align/frontend/src/services/tauri.ts and calls command names from /Users/vriesd/projects/csv-align/frontend/src/services/tauriCommands.ts with invoke(...).

Development and build commands

cargo tauri dev
cd src-tauri && cargo tauri build

/Users/vriesd/projects/csv-align/src-tauri/tauri.conf.json runs cd frontend && npm run dev before desktop dev mode, runs /Users/vriesd/projects/csv-align/scripts/build_frontend_for_tauri.sh before desktop builds, and points Tauri at /Users/vriesd/projects/csv-align/frontend/dist for packaged frontend assets.

Command surface

Command Behavior
create_session Creates a new in-memory comparison session.
delete_session Deletes a session if present.
load_csv_bytes Loads user-selected CSV bytes into file A or file B.
suggest_mappings Suggests column mappings for the active session.
compare Runs comparison using the shared backend workflow.
export_results Opens a native save dialog and writes CSV results.
export_results_html Opens a native save dialog and writes frontend-provided HTML.
save_pair_order Opens a native save dialog and writes a pair-order text file.
load_pair_order Opens a native open dialog and reads a pair-order text file.
save_comparison_snapshot Opens a native save dialog and writes a comparison snapshot JSON file.
load_comparison_snapshot Opens a native open dialog and reads a comparison snapshot JSON file.

The test-only load_csv path-loading command in /Users/vriesd/projects/csv-align/src-tauri/src/commands.rs is behind #[cfg(test)] and is not registered in the production command handler list. Production CSV loading uses load_csv_bytes, while /Users/vriesd/projects/csv-align/frontend/src/services/tauri.ts rejects desktop path loading so file contents stay tied to explicit user file selection.

Native dialogs

Native dialogs come from tauri-plugin-dialog and are limited to open and save permissions in /Users/vriesd/projects/csv-align/src-tauri/capabilities/default.json. The command layer uses dialogs for exports, pair-order save/load, and snapshot save/load. A canceled dialog returns None to the frontend rather than treating cancellation as a backend error.

CSP and capabilities

/Users/vriesd/projects/csv-align/src-tauri/tauri.conf.json defines both production csp and devCsp. Production policy keeps scripts on self, permits inline styles for the frontend, allows local asset/blob/data image sources, limits connections to self, ipc:, and http://ipc.localhost, blocks objects, limits base-uri to self, and prevents framing.

/Users/vriesd/projects/csv-align/src-tauri/capabilities/default.json grants:

  • core:default
  • core:webview:allow-create-webview-window
  • dialog:allow-open
  • dialog:allow-save

Packaging metadata

The desktop package metadata in /Users/vriesd/projects/csv-align/src-tauri/tauri.conf.json identifies the product as CSV Align, the main binary as csv-align, and the app identifier as com.csvalign.desktop. Bundling is active for all supported Tauri targets, uses /Users/vriesd/projects/csv-align/src-tauri/icons/icon.png, sets the license to MIT, and includes platform-specific Linux and macOS bundle metadata.

Related pages

Key source files

File Purpose
/Users/vriesd/projects/csv-align/src-tauri/src/main.rs Desktop entry point, command registration, dialog plugin setup, and shared store management.
/Users/vriesd/projects/csv-align/src-tauri/src/commands.rs Tauri command implementations, filesystem writes, native dialog helpers, and test-only path loading.
/Users/vriesd/projects/csv-align/src-tauri/tauri.conf.json Tauri build settings, CSP, window settings, bundle targets, product metadata, and platform packaging metadata.
/Users/vriesd/projects/csv-align/src-tauri/capabilities/default.json Desktop capability grants for core/webview features and file dialogs.
/Users/vriesd/projects/csv-align/src-tauri/Cargo.toml Tauri wrapper package metadata and dependencies.
/Users/vriesd/projects/csv-align/frontend/src/services/tauri.ts Runtime desktop transport calls and desktop file-loading safeguards.
/Users/vriesd/projects/csv-align/frontend/src/services/tauriCommands.ts Frontend command-name constants mirrored by the Tauri handler list.

Clone this wiki locally