# belmarbelmar/file-sharer architecture

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

- Interactive diagram: https://gitdiagram.com/belmarbelmar/file-sharer
- Repository: https://github.com/belmarbelmar/file-sharer

## Overview

File-Sharer is a desktop application for finding peers on a local network and sending or receiving files. The main workflow starts in the GUI: choose a file or folder, scan for reachable peers, select a recipient, and initiate a transfer; incoming transfers are accepted or rejected and saved locally. Transfer history is stored in config.json. The sampled source supports the GUI’s calls to scanning, sending, receiving, and history helpers; the exact socket-level interaction between sender and receiver is inferred, so it is shown as unverified.

Main entry points: [`gui.py`](https://github.com/belmarbelmar/file-sharer/blob/main/gui.py) (Sharing GUI), [`utils/utils.py`](https://github.com/belmarbelmar/file-sharer/blob/main/utils/utils.py) (History helpers), [`sender.py`](https://github.com/belmarbelmar/file-sharer/blob/main/sender.py) (File sender), [`receiver.py`](https://github.com/belmarbelmar/file-sharer/blob/main/receiver.py) (File receiver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_entry["App entry<br/>[main.py]"]
  node_gui["Sharing GUI<br/>[gui.py]"]
end

subgraph group_transfer["Transfer operations"]
  node_sender["File sender<br/>[sender.py]"]
  node_receiver["File receiver<br/>[receiver.py]"]
end

subgraph group_support["Network and history"]
  node_scanner["Peer scanner<br/>[network.py]"]
  node_history["History helpers<br/>[utils.py]"]
  node_history_store[("Transfer history<br/>[config.json]")]
end

node_user(("User"))
node_peer(("Network peer"))

node_user -->|"launches"| node_entry
node_entry -->|"creates"| node_gui
node_user -->|"operates"| node_gui
node_gui -->|"scans peers"| node_scanner
node_scanner -->|"returns results"| node_gui
node_gui -->|"starts send"| node_sender
node_sender -.->|"sends file"| node_peer
node_peer -.->|"offers file"| node_receiver
node_gui -->|"starts receive"| node_receiver
node_gui -->|"loads history"| node_history
node_sender -->|"records sent"| node_history
node_receiver -->|"records received"| node_history
node_history -->|"reads and writes"| node_history_store

click node_entry "https://github.com/belmarbelmar/file-sharer/blob/main/main.py"
click node_gui "https://github.com/belmarbelmar/file-sharer/blob/main/gui.py"
click node_sender "https://github.com/belmarbelmar/file-sharer/blob/main/sender.py"
click node_receiver "https://github.com/belmarbelmar/file-sharer/blob/main/receiver.py"
click node_scanner "https://github.com/belmarbelmar/file-sharer/blob/main/network.py"
click node_history "https://github.com/belmarbelmar/file-sharer/blob/main/utils/utils.py"
click node_history_store "https://github.com/belmarbelmar/file-sharer/blob/main/config.json"

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_entry,node_gui,node_user toneBlue
class node_sender,node_receiver toneAmber
class node_scanner,node_history,node_history_store toneMint
class node_peer toneIndigo
```

## Components

### Desktop app

- [App entry](https://github.com/belmarbelmar/file-sharer/blob/main/main.py): `main.py`
- [Sharing GUI](https://github.com/belmarbelmar/file-sharer/blob/main/gui.py): `gui.py`

### Transfer operations

- [File sender](https://github.com/belmarbelmar/file-sharer/blob/main/sender.py): `sender.py`
- [File receiver](https://github.com/belmarbelmar/file-sharer/blob/main/receiver.py): `receiver.py`

### Network and history

- [Peer scanner](https://github.com/belmarbelmar/file-sharer/blob/main/network.py): `network.py`
- [History helpers](https://github.com/belmarbelmar/file-sharer/blob/main/utils/utils.py): `utils/utils.py`
- [Transfer history](https://github.com/belmarbelmar/file-sharer/blob/main/config.json): `config.json`

### Other components

- **User**
- **Network peer**

## Connections

- User → App entry: launches (evidence: `main.py`)
- App entry → Sharing GUI: creates (evidence: `main.py`)
- User → Sharing GUI: operates
- Sharing GUI → Peer scanner: scans peers (evidence: `gui.py`)
- Peer scanner → Sharing GUI: returns results (evidence: `gui.py`)
- Sharing GUI → File sender: starts send (evidence: `gui.py`)
- File sender → Network peer: sends file
- Network peer → File receiver: offers file
- Sharing GUI → File receiver: starts receive (evidence: `gui.py`)
- Sharing GUI → History helpers: loads history (evidence: `gui.py`)
- File sender → History helpers: records sent (evidence: `sender.py`)
- File receiver → History helpers: records received (evidence: `receiver.py`)
- History helpers → Transfer history: reads and writes (evidence: `utils/utils.py`)
