# chengazhen/cursor-auto-free architecture

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

- Interactive diagram: https://gitdiagram.com/chengazhen/cursor-auto-free
- Repository: https://github.com/chengazhen/cursor-auto-free

## Overview

##### Main Components

a) Core System Components:
- Authentication Manager (represented by cursor_auth_manager.py)
- Email Verification System (represented by get_email_code.py)
- Token Keep-Alive Service (represented by cursor_pro_keep_alive.py)
- Browser Automation Layer (represented by browser_utils.py)

b) External Services:
- Chrome Browser
- Cloudflare Email Service
- Temp-Mail.plus Service
- Cursor Pro Application

##### Component Relationships

- Rectangles for internal services
- Clouds for external services

1. Configuration Flow:
- .env file → Config Manager (config.py)
- Config Manager → All internal services

2. Main Process Flow:
- Authentication Manager → Browser Automation
- Browser Automation → Cursor Pro Application
- Email Verification System → Cloudflare Email
- Email Verification System → Temp-Mail.plus
- Keep-Alive Service → Cursor Pro Application

##### Key Technical Elements

Technical aspects:
- Environment Configuration (.env)
- Browser Automation Interface
- Email Service Integration
- Token Management System
- Logging System (logger.py)

##### Specific Implementation Details

Create sections showing:
- Authentication Flow
- Email Verification Flow
- Token Refresh Cycle
- Browser Automation Process

##### Additional Elements

Include:
- Build System Components (build.py, build.sh, build.bat)
- Testing Components (test directory)
- Browser Extension (turnstilePatch directory)

##### Automation workflow
- Account Registration Process
- Token Refresh Mechanism
- Email Verification Flow

##### Error handling paths
- Network Failure Scenarios
- Verification Failures
- Token Refresh Failures

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph ConfigLayer["Configuration Layer"]
        Config["Configuration Files"]
        EnvFile[".env File"]:::config
    end

    subgraph AutomationCore["Automation Core"]
        BrowserUtils["Browser Utils"]:::core
        AuthManager["Authentication Manager"]:::core
        EmailVerification["Email Verification"]:::core
        TokenManager["Token Keep-Alive"]:::core
        Logger["Logging System"]:::core
        ResetMachine["Reset Functionality"]:::core
        ExitHandler["Exit Handler"]:::core
    end

    subgraph Security["Security Components"]
        TurnstilePatch["Turnstile Patch"]:::security
        TurnstileScript["Patch Script"]:::security
    end

    subgraph ExternalServices["External Services"]
        Chrome["Chrome Browser"]:::external
        CloudflareEmail["Cloudflare Email"]:::external
        TempMail["Temp-mail.plus"]:::external
        CursorPro["Cursor Pro Platform"]:::external
    end

    subgraph BuildSystem["Build System"]
        BuildScripts["Build Scripts"]:::build
        GithubActions["GitHub Actions"]:::build
    end

    subgraph Testing["Testing Components"]
        TestSuite["Verification Tests"]:::test
    end

    %% Relationships
    ConfigLayer --> AutomationCore
    AutomationCore --> ExternalServices
    Security --> AutomationCore
    BuildSystem --> AutomationCore
    Testing --> AutomationCore

    BrowserUtils <--> AuthManager
    AuthManager <--> EmailVerification
    EmailVerification <--> TokenManager
    Logger --> AutomationCore
    
    %% Click Events
    click BrowserUtils "https://github.com/chengazhen/cursor-auto-free/blob/main/browser_utils.py"
    click AuthManager "https://github.com/chengazhen/cursor-auto-free/blob/main/cursor_auth_manager.py"
    click EmailVerification "https://github.com/chengazhen/cursor-auto-free/blob/main/get_email_code.py"
    click TokenManager "https://github.com/chengazhen/cursor-auto-free/blob/main/cursor_pro_keep_alive.py"
    click Logger "https://github.com/chengazhen/cursor-auto-free/blob/main/logger.py"
    click ResetMachine "https://github.com/chengazhen/cursor-auto-free/blob/main/reset_machine.py"
    click ExitHandler "https://github.com/chengazhen/cursor-auto-free/blob/main/exit_cursor.py"
    click Config "https://github.com/chengazhen/cursor-auto-free/blob/main/config.py"
    click EnvFile "https://github.com/chengazhen/cursor-auto-free/blob/main/.env.example"
    click TurnstilePatch "https://github.com/chengazhen/cursor-auto-free/tree/main/turnstilePatch"
    click TurnstileScript "https://github.com/chengazhen/cursor-auto-free/blob/main/turnstilePatch/script.js"
    click BuildScripts "https://github.com/chengazhen/cursor-auto-free/blob/main/build.py"
    click GithubActions "https://github.com/chengazhen/cursor-auto-free/blob/main/.github/workflows/build.yml"
    click TestSuite "https://github.com/chengazhen/cursor-auto-free/blob/main/test/get_veri_code_test.py"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef external fill:#2ecc71,stroke:#27ae60,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef build fill:#9b59b6,stroke:#8e44ad,color:white
    classDef test fill:#1abc9c,stroke:#16a085,color:white
```
