# syntaxaman/fifaholic architecture

> Architecture diagram of the GitHub repository syntaxaman/fifaholic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/syntaxaman/fifaholic
- Repository: https://github.com/syntaxaman/fifaholic

## Overview

##### Main Components

a) Client-Side Components:
- Windows Client Application
- Web Frontend (Laravel Blade Views)

b) Server-Side Components:
- Laravel Backend API
- Authentication System
- Google Vision API Integration
- Database Layer

##### Detailed Architecture Breakdown

A. Client Layer:
1. Windows Client (External)
- Connection to API endpoints
- Match statistics capture functionality
2. Web Interface
- Components for leagues, teams, matches, and user management
- Authentication views

B. API/Backend Layer:
- LeagueController
- TeamController
- MatchController
- CommentController
- APIController (for external client communication)

C. Service Layer:
- Providers:
- LeagueServiceProvider
- AuthServiceProvider
- RouteServiceProvider
- Google Vision API integration

D. Data Layer:
- Database Models:
- User
- League
- Team
- Matches
- MatchStatistics
- Comments
- Relationships between models

##### Key Interactions to Highlight

1. Windows client → API endpoints (match creation flow)
2. User authentication flow
3. League management operations
4. Match statistics processing pipeline
5. Google Vision API interaction for OCR

##### Technical Details

- Laravel framework components
- Database relationships
- API endpoints
- Middleware layers (shown as filters)
- External service integrations

##### The relationship management between leagues, teams, and matches

Keep the abstraction level focused on the main architectural components while showing the crucial integration points between the Windows client and web application. This will help developers understand both the overall system structure and the specific implementation details that are critical to the project's functionality.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#a8d1f0,stroke:#000
    classDef api fill:#90EE90,stroke:#000
    classDef service fill:#FFE5B4,stroke:#000
    classDef external fill:#FFB6C1,stroke:#000
    classDef data fill:#DDA0DD,stroke:#000
    classDef auth fill:#F0E68C,stroke:#000

    %% Legend
    subgraph Legend
        C1[Client Layer]:::client
        A1[API Layer]:::api
        S1[Service Layer]:::service
        E1[External Services]:::external
        D1[Data Layer]:::data
        Auth1[Auth Components]:::auth
    end

    %% Client Layer
    subgraph ClientLayer
        WinClient[Windows Client Application]:::client
        WebFront[Web Frontend]:::client
        subgraph Views
            AuthViews[Authentication Views]:::client
            LeagueView[League Management View]:::client
            TeamView[Team Management View]:::client
            MatchView[Match Management View]:::client
        end
    end

    %% API Layer
    subgraph APILayer
        APIRoutes[API Routes]:::api
        APIController[API Controller]:::api
        TokenController[Token Controller]:::api
        
        subgraph Controllers
            LeagueController[League Controller]:::api
            TeamController[Team Controller]:::api
            MatchController[Match Controller]:::api
            CommentController[Comment Controller]:::api
        end
    end

    %% Service Layer
    subgraph ServiceLayer
        LeagueService[League Service Provider]:::service
        AuthService[Auth Service Provider]:::service
        RouteService[Route Service Provider]:::service
    end

    %% External Services
    GoogleVision[Google Vision API]:::external

    %% Auth System
    subgraph AuthSystem
        AuthControllers[Auth Controllers]:::auth
        AuthMiddleware[Auth Middleware]:::auth
    end

    %% Data Layer
    subgraph DataLayer
        User[(User)]:::data
        League[(League)]:::data
        Team[(Team)]:::data
        Matches[(Matches)]:::data
        MatchStats[(Match Statistics)]:::data
        Comments[(Comments)]:::data
    end

    %% Relationships
    WinClient --> APIRoutes
    WebFront --> Controllers
    Controllers --> ServiceLayer
    ServiceLayer --> DataLayer
    APIController --> GoogleVision
    AuthSystem --> User
    
    %% Click Events
    click WebFront "https://github.com/Syntaxaman/fifaholic/tree/master/resources/views"
    click AuthViews "https://github.com/Syntaxaman/fifaholic/tree/master/resources/views/auth"
    click LeagueView "https://github.com/Syntaxaman/fifaholic/blob/master/resources/views/league.blade.php"
    click TeamView "https://github.com/Syntaxaman/fifaholic/blob/master/resources/views/team.blade.php"
    click MatchView "https://github.com/Syntaxaman/fifaholic/blob/master/resources/views/match.blade.php"
    click APIRoutes "https://github.com/Syntaxaman/fifaholic/blob/master/routes/api.php"
    click APIController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/APIController.php"
    click TokenController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/TokenController.php"
    click LeagueController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/LeagueController.php"
    click TeamController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/TeamController.php"
    click MatchController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/MatchController.php"
    click CommentController "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Controllers/CommentController.php"
    click AuthControllers "https://github.com/Syntaxaman/fifaholic/tree/master/app/Http/Controllers/Auth"
    click AuthMiddleware "https://github.com/Syntaxaman/fifaholic/blob/master/app/Http/Middleware/Authenticate.php"
    click AuthService "https://github.com/Syntaxaman/fifaholic/blob/master/app/Providers/AuthServiceProvider.php"
    click User "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/User.php"
    click League "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/League.php"
    click Team "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/Team.php"
    click Matches "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/Matches.php"
    click MatchStats "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/MatchStatistics.php"
    click Comments "https://github.com/Syntaxaman/fifaholic/blob/master/app/Models/Comment.php"
    click LeagueService "https://github.com/Syntaxaman/fifaholic/blob/master/app/Providers/LeagueServiceProvider.php"
    click RouteService "https://github.com/Syntaxaman/fifaholic/blob/master/app/Providers/RouteServiceProvider.php"
```
