# techtanic/discounted-udemy-course-enroller architecture

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

- Interactive diagram: https://gitdiagram.com/techtanic/discounted-udemy-course-enroller
- Repository: https://github.com/techtanic/discounted-udemy-course-enroller

## Overview

##### Project Context and Purpose
- Project Type: This is a desktop automation tool with both GUI and CLI interfaces.
- Purpose: It automatically enrolls users into Udemy courses (both free and paid with coupons) by scraping popular coupon sites and using browser cookies for a one-click login. It provides a graphical interface as well as a command-line alternative for automation.

##### File Structure and Components
- Top-Level Files:
- base.py: Likely contains the core application logic that orchestrates the enrollment process.
- cli.py: Entry point for the Command-Line Interface, enabling non-GUI automated use.
- gui.py: The module responsible for the graphical interface.
- images.py: Could be used for handling image assets or visual elements in the GUI.
- default-duce-cli-settings.json & default-duce-gui-settings.json: Configuration files that determine default behavior/settings for CLI and GUI respectively.
- extra (directory): Contains promotional assets, screenshots, and other images referenced in the README.
- .github Directory:
- Contains CI/CD workflows and issue templates that indicate an emphasis on maintaining quality and community contributions.
- Other Documentation:
- README.md and other markdown files provide usage instructions, features, and screenshots, which reinforce the separation between the UI interfaces and the core functionality.

##### Main Components of the System
a. Presentation Layer:
- GUI Module (gui.py): Provides a user-friendly interface including login, coupon scraping, and enrolling processes.
- CLI Module (cli.py): Offers a text-based interface for users who prefer command-line usage or require automation.
b. Application Core:
- Base Layer (base.py): Contains the primary business logic that both frontends use. It likely coordinates the coupon scraping, login using browser cookies, and course enrollment functionalities.
c. Configuration Management:
- JSON Setting Files: Separate configuration files for CLI and GUI (default-duce-cli-settings.json and default-duce-gui-settings.json) to determine run-time options and defaults.
d. External Systems:
- Udemy Platform: Acts as the external service where the tool logs in (using browser cookies) and enrolls courses.
- Coupon Websites: External websites where coupons are sourced for the enrollment process.

##### Relationships and Data Flow
- Both GUI and CLI components act as entry points. They pass user commands and configurations to the core logic in base.py.
- The base/core module processes these commands, interacts with external services (Udemy and coupon sites), and returns status updates or results.
- Configurations from the JSON files are loaded early on to adjust the behavior of either interface appropriately.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        GUI["GUI Interface"]:::presentation
        CLI["CLI Interface"]:::presentation
    end

    %% Application Core
    subgraph "Application Core"
        CORE["Application Core"]:::core
    end

    %% Utility Modules
    subgraph "Utility Modules"
        UTIL_COLOR["Terminal Colors"]:::utility
        UTIL_IMG["Visual Assets"]:::utility
    end

    %% Configuration Management
    subgraph "Configuration Management"
        CFG_CLI["CLI Settings"]:::config
        CFG_GUI["GUI Settings"]:::config
    end

    %% External Systems
    subgraph "External Systems"
        UD["Udemy Platform"]:::external
        COUP["Coupon Sources"]:::external
    end

    %% Relationships
    GUI -->|"sends_commands"| CORE
    CLI -->|"sends_commands"| CORE
    CORE -->|"loads_settings_from"| CFG_CLI
    CORE -->|"loads_settings_from"| CFG_GUI
    CORE -->|"utilizes"| UTIL_COLOR
    CORE -->|"utilizes"| UTIL_IMG
    CORE -->|"integrates_with"| UD
    CORE -->|"integrates_with"| COUP

    %% Click Events
    click GUI "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/gui.py"
    click CLI "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/cli.py"
    click CORE "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/base.py"
    click UTIL_COLOR "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/colors.py"
    click UTIL_IMG "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/images.py"
    click CFG_CLI "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/default-duce-cli-settings.json"
    click CFG_GUI "https://github.com/techtanic/discounted-udemy-course-enroller/blob/master/default-duce-gui-settings.json"

    %% Styles
    classDef presentation fill:#f9f,stroke:#333,stroke-width:2px;
    classDef core fill:#bbf,stroke:#333,stroke-width:2px;
    classDef utility fill:#cfc,stroke:#333,stroke-width:2px;
    classDef config fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#fc9,stroke:#333,stroke-width:2px;
```
