# supthunder/pixel-backup-gang architecture

> Architecture diagram of the GitHub repository supthunder/pixel-backup-gang, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/supthunder/pixel-backup-gang
- Repository: https://github.com/supthunder/pixel-backup-gang

## Overview

##### Project type and purpose
- This is a full‑stack backup application that bridges a Windows PC (GUI + FastAPI server) with a rooted Google Pixel phone (Android client) to enable unlimited Google Photos backups of external media without consuming internal flash.

##### File structure
Top‑level directories and files:
- .github/workflows/ci.yml – CI pipeline
- Makefile – build or helper targets
- android_client/ – the phone’s sync service script
- scripts/ – helper shell scripts for mounting, debugging, device management
- server/ – Python FastAPI backend and GUI front‑end code
– gui.py – Windows GUI application (PyQt6)
– server.py – FastAPI HTTP server
– upload.py – upload queue & file‑handling logic
– requirements.txt – Python dependencies

##### README for additional insights
- Describes three main components: Windows GUI, FastAPI server, Android client
- Details steps for setup, usage, and internal file‑flow

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Windows PC"
    GUI["Windows GUI Application\ngu i.py, assets"]:::gui
    click GUI "https://github.com/supthunder/pixel-backup-gang/blob/master/server/gui.py"
    ASSETS["assets/"]:::gui
    click ASSETS "https://github.com/supthunder/pixel-backup-gang/tree/master/assets/"
    Server["FastAPI Server\nserver.py"]:::server
    click Server "https://github.com/supthunder/pixel-backup-gang/blob/master/server/server.py"
    Upload["Upload Queue & Logic\nupload.py"]:::server
    click Upload "https://github.com/supthunder/pixel-backup-gang/blob/master/server/upload.py"
    Requirements["Requirements\nrequirements.txt"]:::server
    click Requirements "https://github.com/supthunder/pixel-backup-gang/blob/master/server/requirements.txt"

    GUI -->|"Start Server"| Server
    GUI -->|"Watch folder uploads"| Upload
    Upload -->|"process files"| Server
  end

  subgraph "Android Phone"
    Sync["Android Client Sync Service\nsync_service.sh"]:::android
    click Sync "https://github.com/supthunder/pixel-backup-gang/blob/master/android_client/sync_service.sh"
    subgraph "Mount Layer"
      MountExt["mount_ext4.sh"]:::mount
      click MountExt "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/mount_ext4.sh"
      Remount["remount_vfat.sh"]:::mount
      click Remount "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/remount_vfat.sh"
      Unmount["unmount.sh"]:::mount
      click Unmount "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/unmount.sh"
      EnableDebug["enable_tcp_debugging.sh"]:::mount
      click EnableDebug "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/enable_tcp_debugging.sh"
      DisableDebug["disable_tcp_debugging.sh"]:::mount
      click DisableDebug "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/disable_tcp_debugging.sh"
      FindDev["find_device.sh"]:::mount
      click FindDev "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/find_device.sh"
      ShowDev["show_devices.sh"]:::mount
      click ShowDev "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/show_devices.sh"
      StartShell["start_global_shell.sh"]:::mount
      click StartShell "https://github.com/supthunder/pixel-backup-gang/blob/master/scripts/start_global_shell.sh"
    end
    Scanner["Media Scanner"]:::scanner
    Photos["Google Photos App"]:::scanner

    Server -->|"HTTP POST /upload"| Sync
    Sync -->|"mount ext4"| MountExt
    Sync -->|"remount vfat"| Remount
    MountExt --> Scanner
    Scanner -->|"file visible"| Photos
    Photos -->|"sync backup"| Cloud
  end

  Cloud["Google Cloud Storage"]:::cloud

  CI["CI Pipeline\nci.yml"]:::external
  click CI "https://github.com/supthunder/pixel-backup-gang/blob/master/.github/workflows/ci.yml"
  Make["Makefile"]:::external
  click Make "https://github.com/supthunder/pixel-backup-gang/tree/master/Makefile"
  Doc["Project Overview\nREADME.md"]:::external
  click Doc "https://github.com/supthunder/pixel-backup-gang/blob/master/README.md"

classDef gui fill:#DDA0DD,stroke:#333,stroke-width:1px;
classDef server fill:#ADD8E6,stroke:#333,stroke-width:1px;
classDef android fill:#90EE90,stroke:#333,stroke-width:1px;
classDef mount fill:#FF6347,stroke:#333,stroke-width:1px;
classDef scanner fill:#D3D3D3,stroke:#333,stroke-width:1px;
classDef cloud fill:#87CEFA,stroke:#333,stroke-width:1px;
classDef external fill:#F5F5F5,stroke:#333,stroke-width:1px;
```
