# jettcodey/tiktok-downloader architecture

> Architecture diagram of the GitHub repository jettcodey/tiktok-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jettcodey/tiktok-downloader
- Repository: https://github.com/jettcodey/tiktok-downloader

## Overview

##### Main Components

a) User Interface Layer:
- MainForm (primary interface)
- SettingsDialog
- AboutWindow

b) Core Components:
- Download Manager (implied from functionality)
- Cache Manager (from CacheManager.cs)
- Settings Manager (from AppSettings.cs)
- Browser Automation (Playwright integration)

c) External Services:
- TikTok Web Platform
- Third-party HD Video API
- Browser Engines (Chrome, Edge, Firefox, etc.)

**┌─ Presentation Layer ─────────────────────┐**
- MainForm                                 │
- SettingsDialog                          │
- AboutWindow                             │
- ┬─────────────────────┬─┘

**┌─ Business Layer ┴─────────────────────┴─┐**
- ┌─ Download Management ─┐ ┌─ Browser ─┐ │
- Single Download    │ │ Automation │ │
- Batch Download    │ │ (Playwright)│ │
- HD Download       │ └───────────┬─┘ │
- ┬┘             │   │
- ┌─ System Services ──┴─┐ ┌──────────┴─┐ │
- Cache Manager     │ │ - Browser   │ │
- Settings Manager  │ │   Handlers  │ │
- ┬─┘ └────────────┘ │
- ┬┴──────────────────┘

**┌─ External Services ┴──────────────────┐**
- TikTok Web Platform                 │
- HD Video API                        │
- Browser Engines                     │
- ┬──┘

**┌─ File System ──────────────────────┴──┐**
- Downloads (TikTokDownloads folder)  │
- Settings (appsettings.xml)         │
- ┘

##### Additional Elements

- Version information (targeting .NET 8.0)
- Supported file formats (videos, images)
- Default storage locations

##### Technical Details

- Installation path: C:\Program Files\Jettcodey\TikTok Downloader
- Settings location: Documents\Jettcodey\TikTok Downloader\appsettings.xml
- Download path: Desktop\TikTokDownloads\{@Username}\
- Supported browsers list

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef system fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white

    %% Presentation Layer
    subgraph UI
        MainForm["Main Interface"]:::ui
        Settings["Settings Dialog"]:::ui
        About["About Window"]:::ui
    end

    %% Business Layer
    subgraph Business
        subgraph DownloadMgmt["Download Management"]
            SingleDL["Single Download"]:::business
            BatchDL["Batch Download"]:::business
            HDDL["HD Download"]:::business
        end

        subgraph BrowserAuto["Browser Automation"]
            Playwright["Playwright Engine"]:::business
            BrowserHandler["Browser Handlers"]:::business
        end

        subgraph SystemServices["System Services"]
            Cache["Cache Manager"]:::business
            SettingsMgr["Settings Manager"]:::business
        end
    end

    %% External Services
    subgraph External
        TikTok["TikTok Web Platform"]:::external
        HDAPI["HD Video API"]:::external
        Browsers["Browser Engines"]:::external
    end

    %% File System
    subgraph FileSystem
        Downloads["TikTokDownloads"]:::system
        ConfigFiles["appsettings.xml"]:::system
    end

    %% Relationships
    MainForm --> SingleDL
    MainForm --> BatchDL
    MainForm --> HDDL
    MainForm --> Settings
    MainForm --> About
    Settings --> SettingsMgr
    SingleDL & BatchDL & HDDL --> Playwright
    Playwright --> BrowserHandler
    BrowserHandler --> TikTok
    HDDL --> HDAPI
    BrowserHandler --> Browsers
    SettingsMgr --> ConfigFiles
    SingleDL & BatchDL & HDDL --> Downloads
    Cache --> Downloads

    %% Click Events
    click MainForm "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/MainForm.cs"
    click Settings "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/SettingsDialog.cs"
    click About "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/AboutWindow.cs"
    click Cache "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/CacheManager.cs"
    click SettingsMgr "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/AppSettings.cs"
    click Playwright "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/scripts/playwright-ex.bat"
    click ConfigFiles "https://github.com/Jettcodey/TikTok-Downloader/blob/master/src/app.manifest"

    %% Legend
    subgraph Legend
        UI_Legend["UI Components"]:::ui
        Business_Legend["Business Logic"]:::business
        External_Legend["External Services"]:::external
        System_Legend["System Components"]:::system
    end
```
