# ARCHITECTURE

```mermaid
graph TD
    subgraph Interface
        Main["__main__.py (Entry Point)"]
    end

    subgraph Orchestration
        DupMain["dup_main.py (Orchestration)"]
    end

    subgraph Support_Config ["Support & Config"]
        CLI["cli_main.py (Argument Parsing)"]
        Config["config.py (Global Settings)"]
        LogUtil["log.py / util.py (Logging/Support)"]
    end

    subgraph Core_Logic ["Core Logic"]
        Selection["selection.py (File Selection)"]
        Backend["backend.py (Storage Layer)"]
        Errors["errors.py (Exception Mgmt)"]
    end

    subgraph Operation
        DiffDir["diffdir.py (Backup Logic)"]
        Backends["backends/ (Storage Drivers)"]
        PatchDir["patchdir.py (Restore Logic)"]
    end

    subgraph Engines_Metadata ["Engines & Metadata"]
        LibRsync["librsync.py (rsync delta)"]
        GPG["gpg.py (Encryption)"]
        Manifest["manifest.py (Metadata)"]
    end

    Main --> DupMain
    DupMain --> CLI
    DupMain --> Config
    DupMain --> LogUtil

    CLI --> Selection
    Config --> Backend
    LogUtil ~~~ Errors
    Errors -.-> LogUtil

    Selection --> DiffDir
    Backend --> Backends

    DiffDir --> Backends
    PatchDir --> Backends

    DiffDir --> LibRsync
    DiffDir --> GPG
    DiffDir --> Manifest

    PatchDir --> LibRsync
    PatchDir --> GPG
    PatchDir --> Manifest

    Backends --> GPG
```
