# johnw7789/forge architecture

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

- Interactive diagram: https://gitdiagram.com/johnw7789/forge
- Repository: https://github.com/johnw7789/forge

## Overview

##### Main Components
- Frontend Client: Representing the React/Next UI that comprises the user interface. This includes subcomponents for account management, addresses, cards, tasks, and settings. Note the use of NextUI for components and Recoil for state management.
- Backend Service: The core Go application split into various modules:
– General application entry points such as main.go, app.go, and other high-level orchestrators.
– Dedicated modules in the “backend” folder:
- antibot: Contains modules (captcha.go, secure.go, useragent.go) handling anti-detection techniques.
- request: Handles different types of account requests (Amazon, Alexa, 2FA, etc.) and encapsulates complex logic for generating account payloads.
- sms: Organizes support for multiple SMS providers (DaisySMS, SMS Man, SMSpool).
- email: Deals with IMAP functionalities for OTP retrieval.
- discord and shr: Likely for additional integrations and shared utilities.
– Support modules in the root (accounts.go, profiles.go, proxies.go, settings.go, task.go) that possibly tie frontend inputs with backend account operations.
- Wails Bridge: While not a separate “module” folder, the integration layer provided via Wails (see wails.json and wailsjs directories) serves as the communication bridge between the frontend and the Go backend.
– 2Captcha for captcha solving.
– IMAP email services for OTP retrieval.
– SMS providers (DaisySMS, SMS Man, SMS Pool).
– (Potentially) iCloud and Hide My Email (HME) for authentication.

##### Component Relationships & Interactions
- User interactions in the Frontend trigger calls via the Wails bridge that invoke backend functionalities.
- The Backend orchestrates account generation processes by routing requests to the appropriate modules (antibot strategies, SMS/email verifications, etc.).
- Some backend modules interface directly with external services (e.g., sending HTTP requests to 2Captcha endpoints, fetching OTP emails via IMAP, contacting SMS providers).
- Data flows from the backend back to the UI to update user accounts, tasks status, and settings.

##### Architectural Patterns & Design Principles
- Separation of Concerns: Clearly partition the system into frontend, backend modules, and external service integrations.
- Modular Structure: Each subfolder in the backend denotes a set of responsibilities (antibot techniques, request handling, SMS/email communications). This modularity is a key design principle.
- API-Driven Communication: Utilize Wails for binding Go functions to the React frontend. This ensures that the UI remains decoupled from the backend logic while remaining tightly integrated.
- Extensibility: The project is designed to easily support additional account types or integration with more external services in the future.

##### Relevant Technologies and Frameworks
- Wails – The desktop application framework bridging Go and React.
- Go – Powers the backend logic and integrations.
- React/Next.js – Implements the modern UI for the frontend.
- NextUI and Recoil – For UI components and state management.
- External APIs – 2Captcha, IMAP server protocols, SMS provider APIs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        React_Frontend["React/Next UI"]:::frontend
        App_Layer["App Layer (UI)"]:::frontend
        Components["UI Components"]:::frontend
        Wails_Bridge["Wails Bridge"]:::frontend
    end

    subgraph "Backend Layer"
        Go_App_Core["Go App Core (main.go, app.go)"]:::backend
        Antibot["Antibot Module"]:::backend
        Account_Request["Account Request Module"]:::backend
        SMS["SMS Module"]:::backend
        Email["Email Module"]:::backend
        Discord["Discord Integration"]:::backend
        Shared_Resources["Shared Resources (shr)"]:::backend
        
        subgraph "Support Modules"
            Accounts["accounts.go"]:::backend
            Profiles["profiles.go"]:::backend
            Proxies["proxies.go"]:::backend
            Settings["settings.go"]:::backend
            Task["task.go"]:::backend
        end
    end

    subgraph "External Services"
        Captcha["2Captcha Service"]:::external
        IMAP_Email["IMAP Email Service"]:::external
        SMS_Providers["SMS Providers"]:::external
        Extras["iCloud & HME Services"]:::external
    end

    %% Frontend to Backend Communication
    React_Frontend --> Wails_Bridge
    App_Layer --> React_Frontend
    Components --> React_Frontend
    Wails_Bridge --> Go_App_Core

    %% Backend Modules Interactions
    Go_App_Core --> Antibot
    Go_App_Core --> Account_Request
    Go_App_Core --> SMS
    Go_App_Core --> Email
    Go_App_Core --> Discord
    Go_App_Core --> Shared_Resources
    Go_App_Core --> Accounts
    Go_App_Core --> Profiles
    Go_App_Core --> Proxies
    Go_App_Core --> Settings
    Go_App_Core --> Task

    %% External Service Integrations from Backend Modules
    Antibot -->|"uses"| Captcha
    Account_Request -->|"integrates"| Extras
    SMS -->|"calls"| SMS_Providers
    Email -->|"retrieves OTP"| IMAP_Email
    Discord -->|"connects"| Extras

    %% Feedback Loop from Backend to Frontend
    Accounts -- "data update" --> React_Frontend
    Profiles -- "data update" --> React_Frontend
    Proxies -- "data update" --> React_Frontend
    Settings -- "data update" --> React_Frontend
    Task -- "data update" --> React_Frontend

    %% Click Events for Frontend
    click React_Frontend "https://github.com/johnw7789/forge/tree/main/frontend/"
    click App_Layer "https://github.com/johnw7789/forge/tree/main/frontend/src/app/"
    click Components "https://github.com/johnw7789/forge/tree/main/frontend/src/components/"
    click Wails_Bridge "https://github.com/johnw7789/forge/tree/main/frontend/src/wailsjs/"

    %% Click Events for Backend Core
    click Go_App_Core "https://github.com/johnw7789/forge/blob/main/main.go"

    %% Click Events for Backend Modules
    click Antibot "https://github.com/johnw7789/forge/tree/main/backend/antibot/"
    click Account_Request "https://github.com/johnw7789/forge/tree/main/backend/request/"
    click SMS "https://github.com/johnw7789/forge/tree/main/backend/sms/"
    click Email "https://github.com/johnw7789/forge/blob/main/backend/email/imap.go"
    click Discord "https://github.com/johnw7789/forge/blob/main/backend/discord/discord.go"
    click Shared_Resources "https://github.com/johnw7789/forge/tree/main/backend/shr/"

    %% Click Events for Support Modules
    click Accounts "https://github.com/johnw7789/forge/blob/main/accounts.go"
    click Profiles "https://github.com/johnw7789/forge/blob/main/profiles.go"
    click Proxies "https://github.com/johnw7789/forge/blob/main/proxies.go"
    click Settings "https://github.com/johnw7789/forge/blob/main/settings.go"
    click Task "https://github.com/johnw7789/forge/blob/main/task.go"

classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef backend fill:#FFCCCB,stroke:#333,stroke-width:2px;
classDef external fill:#C1E1C1,stroke:#333,stroke-width:2px;
```
