# mizotake/unity-license-activate architecture

> Architecture diagram of the GitHub repository mizotake/unity-license-activate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mizotake/unity-license-activate
- Repository: https://github.com/mizotake/unity-license-activate

## Overview

##### Main Components
- CLI Interface: This includes the command-line environment where the tool is invoked with parameters (email, password, .alf file path, and optionally a two-factor authentication code).
- Core Automation Script (activate.js): The heart of the project where the logic interacts with Puppeteer to automate browser actions.
- Puppeteer Module: Although not explicitly visible in the file tree, this dependency (listed in package.json) handles the headless browser functionality to automate the Unity license activation process.
- External Unity License Website: Represent the Unity website (https://license.unity3d.com/manual) as an external system that the tool interacts with.
- File System & Assets: This includes the .alf input file, image resources in the img folder, and the resulting .ulf file output saved in the project root.
- Package/Dependency Management: package.json and package-lock.json represent the Node.js ecosystem dependencies that facilitate running and updating the tool.

##### Relationships and Data Flow
- Inside the script, show a component labeled “Puppeteer Automation Engine” that represents the module managing browser automation.

##### Highlighting Architectural Patterns
- Separation of concerns: The CLI handling, core automation logic, external service interaction, and file system operations are clearly distinguished.
- That the design leverages puppeteer for screen-scraping/automation, a common pattern in automation tools.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User CLI"]:::user
    CLI["CLI Interface"]:::cli
    Activate["Core Automation Script (activate.js)"]:::script
    Pupp["Puppeteer Automation Engine"]:::puppeteer
    Unity["Unity License Website"]:::external
    FS["File System (Input .alf, Output .ulf)"]:::fs

    User -->|"runs"| CLI
    CLI -->|"invokes"| Activate
    Activate -->|"initiates"| Pupp
    Pupp -->|"automates"| Unity
    Activate -->|"outputsLicense"| FS
    Activate -.->|"uses"| dep1
    Activate -.->|"uses"| dep2
    Activate -.->|"uses"| assets

    subgraph "Node.js Environment"
        dep1["Package Config (package.json)"]:::dependency
        dep2["Lock Config (package-lock.json)"]:::dependency
        assets["Image Assets"]:::asset
    end

    %% Click Events
    click CLI "https://github.com/mizotake/unity-license-activate/blob/master/activate.js"
    click Activate "https://github.com/mizotake/unity-license-activate/blob/master/activate.js"
    click dep1 "https://github.com/mizotake/unity-license-activate/blob/master/package.json"
    click dep2 "https://github.com/mizotake/unity-license-activate/blob/master/package-lock.json"
    click assets "https://github.com/mizotake/unity-license-activate/tree/master/img/"

    %% Styles
    classDef user fill:#ffb6c1,stroke:#000,stroke-width:2px;
    classDef cli fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef script fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef puppeteer fill:#ffe4b5,stroke:#000,stroke-width:2px;
    classDef external fill:#ffc0cb,stroke:#000,stroke-width:2px;
    classDef fs fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef dependency fill:#e0ffff,stroke:#000,stroke-width:2px;
    classDef asset fill:#f0e68c,stroke:#000,stroke-width:2px;
```
