# rusgoldberg/githubworker architecture

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

- Interactive diagram: https://gitdiagram.com/rusgoldberg/githubworker
- Repository: https://github.com/rusgoldberg/githubworker

## Overview

##### Project type and purpose
- This is a cross-platform desktop application written in Java with JavaFX.
- Its goal is to automate and schedule GitHub user actions (e.g., spreading commits over time).
- It follows an MVC-style pattern: FXML-based views, controllers, a service layer to call GitHub, and model objects.

##### File structure
- Top-level build files: build.gradle, settings.gradle → Gradle Java project.
- src/main/java/com/githubclient:
- controllers/…Controller.java → JavaFX controllers (UI logic).
- model/*.java → domain entities: User, Repository, Issue.
- services/GitHubService.java, HttpClient.java → business & HTTP-client layers.
- utils/Config.java → configuration loader (e.g., API tokens, endpoints).
- MainApp.java → JavaFX application entry point.
- src/main/resources/com/githubclient/views → FXML files for login, repo_list, issue_list.
- src/main/resources/.../styles.css → UI styling.
- log4j2.xml → logging configuration.
- test/java mirrors main packages for unit tests.

##### README
- Confirms automation of GitHub actions.
- Technology stack: Java, JavaFX, HTTP calls to GitHub API.

##### Components
a. Frontend (JavaFX UI)
- MainApp (JavaFX Application)
- FXML Views (login.fxml, repo_list.fxml, issue_list.fxml)
- Controllers (LoginController, RepoController, IssueController)
- CSS styling
b. Service Layer
- GitHubService: business logic, schedules actions, maps domain objects.
- HttpClient: sends HTTP requests to GitHub.
c. Model Layer
- Domain entities: User, Repository, Issue.
d. Utility/Configuration
- Config: loads API keys, user preferences.
e. External
- GitHub REST API (external service)
- Local file system (optional for persisting settings or logs)
- Logging subsystem (Log4j2)

##### Relationships and interactions
- User interacts with JavaFX UI.
- Controllers capture user events (e.g., login, fetch repos, schedule actions).
- Controllers call GitHubService APIs.
- GitHubService uses Config to read settings, then invokes HttpClient.
- HttpClient constructs and sends HTTP requests to GitHub API, receives JSON.
- GitHubService transforms HTTP responses into Model objects.
- Controllers update the view with model data.
- Log4j2 captures logs at each layer.
- Tests exercise Controllers, Services, HttpClient, Models.

##### Architectural patterns and design principles
- MVC (Model-View-Controller) for UI separation.
- Service layer abstracts remote API calls.
- Single responsibility: each package handles one concern.
- Dependency injection (manually wiring components in MainApp).
- Configuration externalized (Config class + log4j2.xml).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "UI Layer"
        MainApp["MainApp"]:::frontend
        subgraph "Views (FXML + CSS)"
            LoginView["login.fxml"]:::frontend
            RepoView["repo_list.fxml"]:::frontend
            IssueView["issue_list.fxml"]:::frontend
            Styles["styles.css"]:::frontend
        end
        subgraph "Controllers"
            LoginController["LoginController"]:::frontend
            RepoController["RepoController"]:::frontend
            IssueController["IssueController"]:::frontend
        end
    end

    subgraph "Service Layer"
        GitHubService["GitHubService"]:::service
        HttpClient["HttpClient"]:::service
    end

    subgraph "Model Layer"
        User["User"]:::model
        Repository["Repository"]:::model
        Issue["Issue"]:::model
    end

    subgraph "Utils & Config"
        Config["Config"]:::utils
    end

    ExternalGitHub["GitHub REST API"]:::external
    Logging["log4j2.xml"]:::external

    subgraph "Tests"
        LC_Test["LoginControllerTest"]:::test
        RC_Test["RepoControllerTest"]:::test
        IC_Test["IssueControllerTest"]:::test
        GS_Test["GitHubServiceTest"]:::test
        HC_Test["HttpClientTest"]:::test
        U_Test["UserTest"]:::test
        R_Test["RepositoryTest"]:::test
        I_Test["IssueTest"]:::test
    end

    MainApp --> LoginView
    MainApp --> RepoView
    MainApp --> IssueView
    MainApp --> Styles

    LoginView --> LoginController
    RepoView --> RepoController
    IssueView --> IssueController

    LoginController --> GitHubService
    RepoController --> GitHubService
    IssueController --> GitHubService

    GitHubService --> Config
    GitHubService --> HttpClient

    HttpClient --> ExternalGitHub
    ExternalGitHub --> HttpClient
    HttpClient --> GitHubService

    GitHubService --> User
    GitHubService --> Repository
    GitHubService --> Issue

    LoginController --> LoginView
    RepoController --> RepoView
    IssueController --> IssueView

    MainApp -.-> Logging
    LoginController -.-> Logging
    RepoController -.-> Logging
    IssueController -.-> Logging
    GitHubService -.-> Logging
    HttpClient -.-> Logging

    LC_Test --> LoginController
    RC_Test --> RepoController
    IC_Test --> IssueController
    GS_Test --> GitHubService
    HC_Test --> HttpClient
    U_Test --> User
    R_Test --> Repository
    I_Test --> Issue

    click MainApp "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/MainApp.java"
    click LoginView "https://github.com/rusgoldberg/githubworker/blob/main/src/main/resources/com/githubclient/views/login.fxml"
    click RepoView "https://github.com/rusgoldberg/githubworker/blob/main/src/main/resources/com/githubclient/views/repo_list.fxml"
    click IssueView "https://github.com/rusgoldberg/githubworker/blob/main/src/main/resources/com/githubclient/views/issue_list.fxml"
    click Styles "https://github.com/rusgoldberg/githubworker/blob/main/src/main/resources/com/githubclient/styles/styles.css"
    click LoginController "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/controllers/LoginController.java"
    click RepoController "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/controllers/RepoController.java"
    click IssueController "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/controllers/IssueController.java"
    click GitHubService "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/services/GitHubService.java"
    click HttpClient "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/services/HttpClient.java"
    click User "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/model/User.java"
    click Repository "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/model/Repository.java"
    click Issue "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/model/Issue.java"
    click Config "https://github.com/rusgoldberg/githubworker/blob/main/src/main/java/com/githubclient/utils/Config.java"
    click Logging "https://github.com/rusgoldberg/githubworker/blob/main/src/main/resources/log4j2.xml"
    click LC_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/controllers/LoginControllerTest.java"
    click RC_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/controllers/RepoControllerTest.java"
    click IC_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/controllers/IssueControllerTest.java"
    click GS_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/services/GitHubServiceTest.java"
    click HC_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/services/HttpClientTest.java"
    click U_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/model/UserTest.java"
    click R_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/model/RepositoryTest.java"
    click I_Test "https://github.com/rusgoldberg/githubworker/blob/main/test/java/com/githubclient/model/IssueTest.java"

    classDef frontend fill:#D0E6FF,stroke:#333,stroke-width:1px
    classDef service fill:#DFFFD0,stroke:#333,stroke-width:1px
    classDef model fill:#FFF5B1,stroke:#333,stroke-width:1px
    classDef utils fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef test fill:#FFD1DC,stroke:#333,stroke-width:1px
```
