# hadjsaidsamy2209-glitch/syncmate architecture

> Architecture diagram of the GitHub repository hadjsaidsamy2209-glitch/syncmate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hadjsaidsamy2209-glitch/syncmate
- Repository: https://github.com/hadjsaidsamy2209-glitch/syncmate

## Overview

SyncMate synchronizes a Windows machine’s local folder bidirectionally with an SMB share. On startup, the launcher loads or collects configuration, starts a filesystem watcher, and runs synchronization every 60 seconds. The sync engine compares local and remote file state, resolves conflicts by modification time, transfers files atomically with SHA-256 verification, and propagates deletions through a shared JSON manifest. Local scans track file changes in SQLite. The README documents VPN access and silent startup; these are represented as external environment and startup integration. Edges reflect the excerpts or README; unsampled sync details are not expanded beyond documented behavior.

Main entry points: [`sync.py`](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py) (Sync engine), [`lanceur.py`](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/lanceur.py) (Launcher), [`watcher.py`](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/watcher.py) (Filesystem watcher), [`main.py`](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/main.py) (File scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime control"]
  node_launcher["Launcher<br/>[lanceur.py]"]
  node_config["Persistent config<br/>[config.py]"]
  node_watcher["Filesystem watcher<br/>[watcher.py]"]
end

subgraph group_state["Local state"]
  node_scanner["File scanner<br/>[main.py]"]
  node_database[("SQLite state<br/>[database.py]")]
end

subgraph group_sync["Synchronization"]
  node_syncer["Sync engine<br/>[sync.py]"]
  node_deletions["Deletion manifest<br/>[sync.py]"]
  node_notifications["Transfer notifications<br/>[sync.py]"]
end

subgraph group_external["External storage"]
  node_localfolder["Local folder"]
  node_smb[("SMB share")]
  node_startup["Windows startup"]
  node_vpn["VPN or LAN"]
end

node_user(("User"))

node_user -->|"configures"| node_launcher
node_launcher -->|"loads or saves"| node_config
node_launcher -->|"starts"| node_watcher
node_launcher -->|"runs periodically"| node_syncer
node_launcher -->|"registers startup"| node_startup
node_watcher -->|"triggers scans"| node_scanner
node_scanner -->|"records file state"| node_database
node_syncer -->|"reads local state"| node_database
node_syncer -->|"scans and transfers"| node_localfolder
node_syncer -->|"scans and transfers"| node_smb
node_syncer -->|"reads and updates"| node_deletions
node_syncer -->|"reports transfers"| node_notifications
node_vpn -->|"provides remote access"| node_smb

click node_launcher "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/lanceur.py"
click node_config "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/config.py"
click node_watcher "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/watcher.py"
click node_scanner "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/main.py"
click node_database "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/database.py"
click node_syncer "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py"
click node_deletions "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py"
click node_notifications "https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.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_launcher,node_config,node_watcher,node_user toneBlue
class node_scanner,node_database toneAmber
class node_syncer,node_deletions,node_notifications toneMint
class node_localfolder,node_smb,node_startup,node_vpn toneRose
```

## Components

### Runtime control

- [Launcher](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/lanceur.py): `lanceur.py`
- [Persistent config](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/config.py): `config.py`
- [Filesystem watcher](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/watcher.py): `watcher.py`

### Local state

- [File scanner](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/main.py): `main.py`
- [SQLite state](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/database.py): `database.py`

### Synchronization

- [Sync engine](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py): `sync.py`
- [Deletion manifest](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py): `sync.py`
- [Transfer notifications](https://github.com/hadjsaidsamy2209-glitch/syncmate/blob/master/sync.py): `sync.py`

### External storage

- **Local folder**
- **SMB share**
- **Windows startup**
- **VPN or LAN**

### Other components

- **User**

## Connections

- User → Launcher: configures (evidence: `lanceur.py`)
- Launcher → Persistent config: loads or saves (evidence: `lanceur.py`)
- Launcher → Filesystem watcher: starts (evidence: `lanceur.py`)
- Launcher → Sync engine: runs periodically (evidence: `lanceur.py`)
- Launcher → Windows startup: registers startup (evidence: `lanceur.py`)
- Filesystem watcher → File scanner: triggers scans (evidence: `watcher.py`)
- File scanner → SQLite state: records file state (evidence: `main.py`)
- Sync engine → SQLite state: reads local state (evidence: `sync.py`)
- Sync engine → Local folder: scans and transfers (evidence: `README.md`)
- Sync engine → SMB share: scans and transfers (evidence: `README.md`)
- Sync engine → Deletion manifest: reads and updates (evidence: `sync.py`)
- Sync engine → Transfer notifications: reports transfers (evidence: `sync.py`)
- VPN or LAN → SMB share: provides remote access (evidence: `README.md`)
