Product · Dogra Technologies

DCo — Compare Easily

A fast, modern, cross-platform folder & file comparison and merge desktop application. A Tauri 2 + Rust core drives a Svelte 4 + TypeScript UI, delivering high-performance directory diffing, word-by-word file comparison, visual image diffing, and safe interactive merges.

Tauri v2 Rust 2021 Svelte 4 TypeScript 5 Vite 5 MIT License v1.0.0

01System Architecture

DCo follows a hybrid architecture: a memory-safe Rust core performs all heavy compute (scanning, hashing, diffing, merging), while an OS-rendered Svelte webview provides the UI. They communicate over Tauri v2 IPC — commands for request/response and ipc::Channel for streaming progress.

Svelte UI TS
ui/src
App.svelte · DirTree · SideBySideTree
DiffViewer · MergeBar · CompareModal
ImageDiffViewer · AuditLogModal
Tauri IPC Rust
src-tauri/src/commands.rs
#[tauri::command]
invoke · ipc::Channel · State
Diff & Merge Engine
src-tauri/src/diff/*
myers.rs · patience.rs · blockhash.rs
Scanner & IO
src-tauri/src
scanner.rs · filecmp.rs · merge.rs
encoding.rs · model.rs

The frontend webview runs on the operating system's native WebView (WKWebView / WebView2 / WebKitGTK), so no browser is bundled. Core compute stays in Rust, keeping the UI snapshot small and memory efficient.

02Capabilities

DCo moves from coarse folder-level status down to character-level precision, and safely applies changes back to disk.

Side-by-Side Directory Comparison

Locked 1-to-1 synchronized scrolling across dual pane trees with recursive, collapsed-aware DIFF highlighting. Recursively scans, then classifies every entry.

Line & Word-by-Word Diffing

Side-by-side line alignment plus intra-line word-level segment highlighting (red = deletions, green = additions). Context filtering isolates affected change blocks.

Interactive Merge Controls

Inline Copy Right ▶ / ◀ Copy Left actions per hunk, bulk hunk selection, Apply selected and Export patch, plus atomic .bak backups.

Visual Image Comparison

Side-by-side and opacity-overlay comparison for .png .jpg .jpeg .webp .svg .gif .ico with binary-file detection.

Folder Synchronization

One-way or mirror sync (rightToLeft, leftToRight, mirror) with orphan pruning and timestamped backups.

Full-Window Drag & Drop

Drag folders onto left/right drop zones or tree columns to load new directories instantly, with reactive auto-compare on path entry.

Safety & Auditability

Read-only mode, persistent merge audit log (.dcompare_audit.log), and a render-side verify_property_ownership guard for the static bundle.

Reporting & Exporting

Export comparison reports as CSV, HTML, or plain text. Glob-pattern ignore rules (node_modules, .git, *.log).

03Rust Backend — src-tauri

The core is a Rust crate exposed as a lib (cdylib / rlib) named dcompare_lib. Release builds are optimized with LTO, opt-level 3, codegen-units 1, and panic = abort.

Key modules & responsibilities

Module Role Key techniques
scanner.rs Parallel directory traversal & manifest comparison Rayon parallelism, iterative (non-recursive) walk, BLAKE3 hashing, size+mtime pre-filter, cancellation token
filecmp.rs Per-file line extraction & full diff orchestration Encoding detection (encoding_rs), memory mapping, memchr line splitting, block-hash pre-filter
diff/myers.rs Core edit-script algorithm Myers O(ND) with V-array trace backtrace & linear-space trim
diff/patience.rs Patience diff for structured-code readability Unique-common-line anchoring
diff/blockhash.rs Huge-file pre-filter Parallel block hashing, rolling-window anchor matching
merge.rs Hunk application & backup generation Staleness re-check, temp-file + atomic rename, timestamped .bak
encoding.rs Charset detection & decoding encoding_rs label detection
commands.rs Tauri IPC surface & audit log All #[tauri::command]s, report export, image base64

Character processing pipeline

1
Wake
Detect BOM / label, decode to lines
2
Anchoring
Block-hash anchors for very large files
3
Align
Myers / Patience edit script
4
Segment
Intra-line word-level segments
5
Hunk + Merge
Group runs, merge selected hunks

Key dependencies

tauri 2

Desktop shell, IPC, ipc::Channel streaming, plugins: dialog, opener.

rayon 1

Parallel directory walking and block hashing for multi-core throughput.

blake3 1

Very fast content hashing for file-equality confirmation.

memmap2 / memchr

Memory-mapped reads and cache-friendly line splitting on large files.

tokio 1

Async runtime for async commands & non-blocking IO.

encoding_rs

Charset detection and UTF-8 transcoding.

04Svelte Frontend — ui/src

The UI is a typed Svelte component tree. The single typed gateway (api.ts) wraps Tauri invoke calls, while components handle rendering, diff state, and merge workflows.

Component Role
App.svelteRoot shell: toolbar, summary header, reactive auto-compare, system theme
api.tsType-safe Tauri IPC binding layer (all backend commands)
SideBySideTree.svelteDual-pane tree with synchronized scrolling & center inspector
DirTree / DirTreeNode.svelteRecursive, expandable (explorer-style) tree nodes with DIFF badges
ThreeWayTree.svelteThree-way comparison tree listing
CompareModal.svelteFull-screen line & image diff workspace
DiffViewer.svelteSide-by-side code diff + inline move buttons & "exists only in Left/Right" banners
MergeBar.svelteHunk selection, Apply selected, Export patch
ImageDiffViewer.svelteSide-by-side & opacity-overlay image comparison
CsvDiffViewer / JsonDiffViewer / HexDiffViewerStructured & binary-oriented inspection modes
SavedSessionsModal / SettingsModal / AboutModalPersistence, configuration, and info
FolderSyncModal.svelteOne-way / mirror folder sync interface
AuditLogModal.svelteMerge history & audit log viewer

Tooling: Vite 5 (dev server, HMR at port 1420) with @sveltejs/vite-plugin-svelte, svelte-check, ESLint (TypeScript + Svelte), Prettier, and Vitest.

05Performance & Reliability Engineering

DCo is engineered around real-world directory sizes and careful data-race safety.

Multi-threaded scanning

Both trees walked in parallel with rayon. Pre-filter by (size, mtime); expensive BLAKE3 hashing only runs when ambiguity remains.

Bounded memory on huge files

Files < 8 MB read inline; larger files are memory-mapped (memmap2) and split with memchr to avoid full copies.

Huge-file block matching

Files > ~200k lines use block-hash pre-filtering to anchor equal regions and diff only the gaps.

Occupied-slot diffing

Myers O(ND) with trace backtrace plus linear-space prefix/suffix trimming for wide edits.

Streaming & cancellation

Scans stream via ipc::Channel with a shared CancellationToken for responsive Stop; commands use spawn_blocking to keep the UI thread free.

Crash-safe writes

Merges and syncs write via temp + atomic rename and re-check staleness, preventing stale overwrites and partial files.

06Build & Availability

Prerequisites: Node.js ≥ 18, npm ≥ 9, Rust toolchain ≥ 1.70, plus platform toolchains (Xcode CLT on macOS, WebKitGTK stack on Linux, VS C++ Build Tools on Windows).

Command Purpose
npm run tauri devRun in dev with Vite HMR + Rust hot reload
npm run tauri buildRelease bundle (dmg / msi · exe / deb · AppImage)
cargo test --libRust unit tests (diff, scanner, merge)
npx svelte-checkType-check the Svelte/TS UI
npm testVitest frontend suite
Open source under the MIT License, produced by Dogra Technologies Pvt. Ltd. Binaries target macOS, Windows, and Linux. Provided “AS IS” without warranty — always verify backups before merging on production directories.
WhatsApp Us Start Your Project