# undebuggable/backup-stuff architecture

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

- Interactive diagram: https://gitdiagram.com/undebuggable/backup-stuff
- Repository: https://github.com/undebuggable/backup-stuff

## Overview

##### Main Components

a. Configuration Layer:
- INI File Parser (config_file.py)
- Configuration Manager (config/config.py)
- This as the entry point for all backup operations

b. Core Backup Engine:
- Backup Manager (app/backup.py)
- Unbackup Manager (app/unbackup.py)
- Utilities (app/utils.py)

c. Source Handlers:
- Local File/Directory Handler
- Remote File/Directory Handler
- Compression Handler

##### Component Relationships

**[Configuration Layer] → [Core Backup Engine] → [Source Handlers]**

##### Specific Elements

a. Input Sources (Left side):
- Local Files/Directories
- Remote Files/Directories
- INI Configuration File

b. Processing Components (Center):
- Config Parser
- Backup Manager
- Compression Engine

c. Output (Right side):
- Backup Archives
- Compressed Archives
- Renamed Archives (via mappings)

##### Data Flow Representation

- Configuration file reading flow
- Source file/directory reading flow
- Backup creation flow
- Compression process flow (when enabled)
- Archive naming/mapping flow

##### Important Details to Highlight

- Distinction between local and remote source handling
- Where compression occurs in the pipeline
- Configuration-driven nature of the system
- Mapping/renaming capability

##### Architectural Patterns to Emphasize

- Command pattern for backup/unbackup operations
- Strategy pattern for different source types
- Factory pattern for handler creation
- Configuration-driven architecture

**[Input Sources] → [Configuration] → [Processing] → [Output]**

- Different source type handlers
- Compression indicators

Keep the abstraction level focused on the main components while showing the key features:
- Configuration handling
- Local/remote source support
- Compression capabilities
- Archive management

This will provide a clear understanding of how the backup utility processes different types of sources and creates backups based on the configuration provided.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        LF[Local Files]
        RF[Remote Files]
        CF[Config INI]
    end

    subgraph ConfigLayer
        CP["INI File Parser"]:::config
        CM["Configuration Manager"]:::config
    end

    subgraph CoreEngine
        BM["Backup Manager"]:::core
        UB["Unbackup Manager"]:::core
        UT["Utilities"]:::core
    end

    subgraph SourceHandlers
        LH["Local Handler"]:::handler
        RH["Remote Handler"]:::handler
        CH["Compression Handler"]:::handler
    end

    subgraph Output
        BA["Backup Archives"]:::output
        CA["Compressed Archives"]:::output
        RA["Renamed Archives"]:::output
    end

    %% Input to Config
    LF --> CP
    RF --> CP
    CF --> CP
    CP --> CM

    %% Config to Core
    CM --> BM
    CM --> UB
    BM --> UT
    UB --> UT

    %% Core to Handlers
    BM --> LH
    BM --> RH
    BM --> CH
    UB --> LH
    UB --> RH

    %% Handlers to Output
    LH --> BA
    RH --> BA
    CH --> CA
    BA --> RA

    %% Click Events
    click CP "https://github.com/undebuggable/backup-stuff/blob/master/backup_dirs_pkg/app/config_file.py"
    click CM "https://github.com/undebuggable/backup-stuff/blob/master/backup_dirs_pkg/config/config.py"
    click BM "https://github.com/undebuggable/backup-stuff/blob/master/backup_dirs_pkg/app/backup.py"
    click UB "https://github.com/undebuggable/backup-stuff/blob/master/backup_dirs_pkg/app/unbackup.py"
    click UT "https://github.com/undebuggable/backup-stuff/blob/master/backup_dirs_pkg/app/utils.py"

    %% Styling
    classDef config fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#e67e22,stroke:#d35400,color:white
    classDef handler fill:#2ecc71,stroke:#27ae60,color:white
    classDef output fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1["Configuration Components"]:::config
        L2["Core Components"]:::core
        L3["Handler Components"]:::handler
        L4["Output Components"]:::output
    end
```
