# jaammerr/the-dawn-bot architecture

> Architecture diagram of the GitHub repository jaammerr/the-dawn-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaammerr/the-dawn-bot
- Repository: https://github.com/jaammerr/the-dawn-bot

## Overview

##### Project type and purpose
- This is a Python-based command-line automation tool (“Dawn Extension Bot”) that orchestrates account operations (register/login/farm/complete tasks/export stats) against an external web service (the “Dawn” extension). It’s not a web server, but a CLI orchestrator with plugin-style modules, a local database, config files, and integrations with external services (proxies, email, captcha providers).

##### File structure
- Top-level entry points:
- run.py / application.py – bootstrapping & command dispatcher
- console/ – CLI layer (argument parsing, text UI)
- core/ – domain logic:
- core/api – HTTP wrappers for the Dawn extension
- core/bot – base classes & orchestration
- core/modules – task executor
- core/solvers – captcha-solver integrations
- database/ – ORM models & settings
- utils/ – cross-cutting helpers: config loaders, file I/O, proxy/email managers, logging, progress tracking
- config/ – YAML settings & account data files
- You also have requirements.txt, README.md, and loader.py for dynamic plugin loading.

##### README for additional insights
- Lists supported modules (register, login, farm, complete tasks, export stats, clean proxies)
- Mentions dependencies (Python 3.11, proxies, email, captcha services)

a. Main components:
- CLI/Console Layer
- Core Orchestrator & Modules
- HTTP/API Client for Dawn Extension
- Captcha Solver Integrations (2Captcha, AntiCaptcha)
- Database (accounts, stats)
- Config Store (YAML + account data files)
- Utility Services (Proxy Manager, Email/IMAP Manager, Logger)
- External Services: Proxies, Email Provider, Captcha Service, Dawn Web Service
b. Relationships & interactions:
1. User invokes CLI (console/main.py) → CLI parses commands → dispatches to Core Orchestrator.
2. Core Orchestrator (application.py) loads settings (load_config) and account data → creates Task Executor (core/modules/executor.py).
3. For each task:
– Executor uses API Client (core/api/dawn.py) to send HTTP requests via Proxy Manager (utils/managers/proxy_manager.py).
– If a CAPTCHA challenge arises, Executor calls the appropriate solver (core/solvers/*.py) which in turn calls external Captcha APIs.
– Email verifications use IMAP utils (utils/communication/imap_utils.py).
4. Results & intermediate state are written to Database (SQLAlchemy models in database/models/*.py).
5. Progress & logs are emitted to Console (utils/communication/console.py) and Logger (console/logger.py).
c. Architectural patterns:
- Modular plugin pattern for tasks (Executor + module registry)
- Layered architecture: CLI → Orchestrator → API/Modules → Persistence
- Dependency injection of utils (config, proxy, logger) into core components
d. Key technologies/frameworks:
- Python 3.11, YAML for config
- SQLAlchemy or built-in ORM (database/models)
- Requests or HTTPX for API calls
- Third-party captcha services (2Captcha, AntiCaptcha)
- IMAP for email verification

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI Layer
    subgraph "CLI Layer"
        CLI["Console UI"]:::core
        CLIlogger["Console Logger"]:::utils
    end

    %% Orchestrator
    subgraph "Orchestrator Layer"
        Orchestrator["Core Orchestrator"]:::core
    end

    %% Configuration
    subgraph "Configuration"
        LoadConfig["Config Loader"]:::utils
        ConfigStore["Config Store"]:::storage
    end

    %% Core Components
    subgraph "Core Components"
        Executor["Task Executor"]:::core
        APIClient["API Client"]:::core
    end

    %% Utilities
    subgraph "Utilities"
        ProxyMgr["Proxy Manager"]:::utils
        EmailMgr["Email Manager"]:::utils
        Progress["Progress Tracker"]:::utils
        Logs["Logging Utility"]:::utils
    end

    %% Persistence
    subgraph "Persistence"
        Database[(Database)]:::storage
    end

    %% Captcha Solvers
    subgraph "Captcha Solvers"
        AntiCaptcha["AntiCaptcha Solver"]:::core
        TwoCaptcha["2Captcha Solver"]:::core
    end

    %% External Services
    subgraph "External Services"
        DawnService("Dawn Web Service"):::external
        CaptchaExt("Captcha Providers"):::external
        EmailService("Email Service"):::external
        ProxyService("Proxy Service"):::external
    end

    %% Connections
    CLI -->|"commands"| Orchestrator
    Orchestrator -->|"load settings"| LoadConfig
    LoadConfig -->|"reads YAML/data files"| ConfigStore
    Orchestrator -->|"init plugins"| Executor
    Executor -->|"invoke HTTP"| APIClient
    APIClient -->|"uses proxy"| ProxyMgr
    ProxyMgr -->|"forward requests"| ProxyService
    Executor -->|"CAPTCHA request"| AntiCaptcha
    Executor -->|"CAPTCHA request"| TwoCaptcha
    AntiCaptcha -->|"API call"| CaptchaExt
    TwoCaptcha -->|"API call"| CaptchaExt
    Executor -->|"email actions"| EmailMgr
    EmailMgr -->|"IMAP interactions"| EmailService
    Executor -->|"write/read"| Database
    Orchestrator -->|"startup state"| Database
    Executor -->|"progress updates"| Progress
    Orchestrator -->|"log events"| Logs
    Executor -->|"log events"| Logs
    Logs -->|"output logs"| CLIlogger
    APIClient -->|"calls Dawn"| DawnService

    %% Click Events
    click CLI "https://github.com/jaammerr/the-dawn-bot/blob/2.1/console/main.py"
    click CLIlogger "https://github.com/jaammerr/the-dawn-bot/blob/2.1/console/logger.py"
    click Orchestrator "https://github.com/jaammerr/the-dawn-bot/blob/2.1/application.py"
    click Orchestrator "https://github.com/jaammerr/the-dawn-bot/blob/2.1/run.py"
    click LoadConfig "https://github.com/jaammerr/the-dawn-bot/blob/2.1/utils/base/load_config.py"
    click ConfigStore "https://github.com/jaammerr/the-dawn-bot/blob/2.1/config/settings.yaml"
    click ConfigStore "https://github.com/jaammerr/the-dawn-bot/blob/2.1/config/data/*.txt"
    click Executor "https://github.com/jaammerr/the-dawn-bot/blob/2.1/core/modules/executor.py"
    click APIClient "https://github.com/jaammerr/the-dawn-bot/blob/2.1/core/api/dawn.py"
    click AntiCaptcha "https://github.com/jaammerr/the-dawn-bot/blob/2.1/core/solvers/anti_captcha.py"
    click TwoCaptcha "https://github.com/jaammerr/the-dawn-bot/blob/2.1/core/solvers/two_captcha.py"
    click ProxyMgr "https://github.com/jaammerr/the-dawn-bot/blob/2.1/utils/managers/proxy_manager.py"
    click EmailMgr "https://github.com/jaammerr/the-dawn-bot/blob/2.1/utils/communication/imap_utils.py"
    click Database "https://github.com/jaammerr/the-dawn-bot/blob/2.1/database/models/accounts.py"
    click Database "https://github.com/jaammerr/the-dawn-bot/blob/2.1/database/settings.py"
    click Logs "https://github.com/jaammerr/the-dawn-bot/blob/2.1/utils/communication/logs.py"
    click Progress "https://github.com/jaammerr/the-dawn-bot/blob/2.1/utils/processing/progress.py"

    %% Styles
    classDef core fill:#e0f7e9,stroke:#2c6f4a,stroke-width:1px
    classDef utils fill:#e0f0ff,stroke:#2267b5,stroke-width:1px
    classDef storage fill:#fff9c4,stroke:#b59f00,stroke-width:1px
    classDef external fill:#eeeeee,stroke:#999999,stroke-width:1px,stroke-dasharray: 2 2
```
