# wynalazca382/offline-first-conflict-resolution-strategies architecture

> Architecture diagram of the GitHub repository wynalazca382/offline-first-conflict-resolution-strategies, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wynalazca382/offline-first-conflict-resolution-strategies
- Repository: https://github.com/wynalazca382/offline-first-conflict-resolution-strategies

## Overview

The repository is a research system for comparing offline-first note-sync conflict-resolution strategies. Its main user workflow is editing notes in the desktop app, recording local operations, and manually synchronizing them through a server before applying a selected merge strategy. A separate experiment runner evaluates strategies across S1–S5, writes measurements, and a plotting tool summarizes them. The README documents the scenario and reporting capabilities; unsampled experiment details are represented only at the documented subsystem level.

Main entry points: [`src-tauri/src/lib.rs`](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/lib.rs) (Sync workflow), [`server/run_all_experiments.py`](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py) (Experiment runner), [`src-tauri/src/models.rs`](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/models.rs) (Note operations), [`src-tauri/src/db.rs`](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/db.rs) (Local SQLite)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop notes"]
  node_frontend["Notes UI<br/>[main.ts]"]
  node_commands["Tauri commands<br/>[lib.rs]"]
  node_models["Note operations<br/>[models.rs]"]
  node_localdb[("Local SQLite<br/>[db.rs]")]
end

subgraph group_sync["Synchronization"]
  node_syncflow["Sync workflow<br/>[lib.rs]"]
  node_strategies["Merge strategies<br/>[sync.rs]"]
  node_metrics["Sync metrics<br/>[sync.rs]"]
end

subgraph group_server["Sync server"]
  node_syncapi["Sync API<br/>[main.py]"]
  node_serverdb[("Operation log<br/>[main.py]")]
end

subgraph group_research["Experiments and analysis"]
  node_experiment["Experiment runner"]
  node_scenario["S1–S5 scenarios"]
  node_evaluation["Merge evaluation"]
  node_measurements["Experiment results"]
  node_plots["Result plots<br/>[plot_results.py]"]
end

node_user(("User"))

node_user -->|"edits notes"| node_frontend
node_frontend -->|"invokes commands"| node_commands
node_commands -->|"reads and writes"| node_localdb
node_commands -->|"creates operations"| node_models
node_localdb -->|"maps records"| node_models
node_commands -->|"dispatches sync"| node_syncflow
node_syncflow -->|"loads and applies"| node_localdb
node_syncflow -->|"resolves conflicts"| node_strategies
node_syncflow -->|"pushes and pulls"| node_syncapi
node_syncflow -->|"records metrics"| node_metrics
node_syncflow -->|"transfers operations"| node_models
node_strategies -->|"resolves notes"| node_models
node_syncapi -->|"stores and queries"| node_serverdb
node_experiment -->|"runs scenarios"| node_scenario
node_experiment -->|"evaluates merges"| node_evaluation
node_experiment -->|"resets and synchronizes"| node_syncapi
node_experiment -->|"writes measurements"| node_measurements
node_plots -->|"reads results"| node_measurements

click node_frontend "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src/main.ts"
click node_commands "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/lib.rs"
click node_models "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/models.rs"
click node_localdb "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/db.rs"
click node_syncflow "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/lib.rs"
click node_strategies "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/sync.rs"
click node_metrics "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/sync.rs"
click node_syncapi "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/main.py"
click node_serverdb "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/main.py"
click node_experiment "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py"
click node_scenario "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py"
click node_evaluation "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py"
click node_measurements "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/tree/main/results"
click node_plots "https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/plot_results.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_commands,node_models,node_localdb,node_user toneBlue
class node_syncflow,node_strategies,node_metrics toneAmber
class node_syncapi,node_serverdb toneMint
class node_experiment,node_scenario,node_evaluation,node_measurements,node_plots toneRose
```

## Components

### Desktop notes

- [Notes UI](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src/main.ts): `src/main.ts`
- [Tauri commands](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Note operations](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/models.rs): `src-tauri/src/models.rs`
- [Local SQLite](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/db.rs): `src-tauri/src/db.rs`

### Synchronization

- [Sync workflow](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Merge strategies](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/sync.rs): `src-tauri/src/sync.rs`
- [Sync metrics](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/src-tauri/src/sync.rs): `src-tauri/src/sync.rs`

### Sync server

- [Sync API](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/main.py): `server/main.py`
- [Operation log](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/main.py): `server/main.py`

### Experiments and analysis

- [Experiment runner](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py): `server/run_all_experiments.py`
- [S1–S5 scenarios](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py): `server/run_all_experiments.py`
- [Merge evaluation](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/run_all_experiments.py): `server/run_all_experiments.py`
- [Experiment results](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/tree/main/results): `results`
- [Result plots](https://github.com/wynalazca382/offline-first-conflict-resolution-strategies/blob/main/server/plot_results.py): `server/plot_results.py`

### Other components

- **User**

## Connections

- User → Notes UI: edits notes (evidence: `src/main.ts`)
- Notes UI → Tauri commands: invokes commands (evidence: `src/main.ts`)
- Tauri commands → Local SQLite: reads and writes (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → Note operations: creates operations (evidence: `src-tauri/src/lib.rs`)
- Local SQLite → Note operations: maps records (evidence: `src-tauri/src/db.rs`)
- Tauri commands → Sync workflow: dispatches sync (evidence: `src-tauri/src/lib.rs`)
- Sync workflow → Local SQLite: loads and applies (evidence: `src-tauri/src/lib.rs`)
- Sync workflow → Merge strategies: resolves conflicts (evidence: `src-tauri/src/lib.rs`)
- Sync workflow → Sync API: pushes and pulls (evidence: `src-tauri/src/lib.rs`)
- Sync workflow → Sync metrics: records metrics (evidence: `src-tauri/src/lib.rs`)
- Sync workflow → Note operations: transfers operations (evidence: `src-tauri/src/lib.rs`)
- Merge strategies → Note operations: resolves notes (evidence: `src-tauri/src/sync.rs`)
- Sync API → Operation log: stores and queries (evidence: `server/main.py`)
- Experiment runner → S1–S5 scenarios: runs scenarios (evidence: `README.md`)
- Experiment runner → Merge evaluation: evaluates merges (evidence: `server/run_all_experiments.py`)
- Experiment runner → Sync API: resets and synchronizes (evidence: `server/run_all_experiments.py`)
- Experiment runner → Experiment results: writes measurements (evidence: `server/run_all_experiments.py`)
- Result plots → Experiment results: reads results (evidence: `README.md`)
