# maxx2001/dartzz architecture

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

- Interactive diagram: https://gitdiagram.com/maxx2001/dartzz
- Repository: https://github.com/maxx2001/dartzz

## Overview

##### Main Components

a) Frontend Layer:
- Vue.js Components (resources/js/*)
- Main pages: SignInPage and TurnCreatePage
- Component hierarchy with Layouts and Partials
- Inertia.js as the bridge between frontend and backend

b) Backend Layer:
- Controllers (GameController, TurnController, ProfileController)
- Actions Layer (Game and Turn actions)
- Models Layer (Game, Player, Turn, User)
- HTTP Resources for API responses
- Request Validation Layer

c) Database Layer:
- MariaDB (as indicated by docker setup)
- Main tables: users, games, players, turns

d) Infrastructure:
- Docker containers (PHP and MariaDB)
- Cache system
- Queue system (indicated by jobs table)

##### Component Relationships

- Frontend → Inertia.js → Controllers
- Controllers → Actions → Models → Database
- HTTP Requests → Middleware → Controllers
- Controllers → Resources → Frontend

##### Specific Implementation Details

Create distinct sections for:
a) Authentication Flow:
- Auth routes and middleware
- To the User model
- Link to profile management

b) Game Flow:
- Game creation process
- Turn management
- Score tracking system

##### Additional Elements

Include:
- Configuration files influence (config/gameRules.php)
- Cache and queue systems
- Storage structure
- Testing infrastructure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph Frontend
        VuePages["Vue Pages"]:::frontend
        click VuePages "https://github.com/Maxx2001/Dartzz/tree/master/resources/js/Pages/"
        SignInPage["Sign In Page"]:::frontend
        click SignInPage "https://github.com/Maxx2001/Dartzz/blob/master/resources/js/Pages/SignIn/SignInPage.vue"
        TurnCreatePage["Turn Create Page"]:::frontend
        click TurnCreatePage "https://github.com/Maxx2001/Dartzz/blob/master/resources/js/Pages/Turn/TurnCreatePage.vue"
        MainLayout["Default Layout"]:::frontend
        click MainLayout "https://github.com/Maxx2001/Dartzz/blob/master/resources/Layouts/DefaultLayout.vue"
        FormComponents["Form Components"]:::frontend
        click FormComponents "https://github.com/Maxx2001/Dartzz/tree/master/resources/js/Components/Forms/"
        Inertia["Inertia.js Bridge"]:::frontend
    end

    subgraph Controllers
        GameC["Game Controller"]:::controller
        click GameC "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Controllers/GameController.php"
        TurnC["Turn Controller"]:::controller
        click TurnC "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Controllers/TurnController.php"
        ProfileC["Profile Controller"]:::controller
        click ProfileC "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Controllers/ProfileController.php"
    end

    subgraph Actions
        GameActions["Game Actions"]:::action
        click GameActions "https://github.com/Maxx2001/Dartzz/blob/master/app/Actions/Game/GameCreateAction.php"
        TurnActions["Turn Actions"]:::action
        click TurnActions "https://github.com/Maxx2001/Dartzz/blob/master/app/Actions/Turn/TurnCreateAction.php"
    end

    subgraph Validation
        GameVal["Game Validation"]:::validation
        click GameVal "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Requests/GameStoreRequest.php"
        TurnVal["Turn Validation"]:::validation
        click TurnVal "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Requests/TurnStoreRequest.php"
        ProfileVal["Profile Validation"]:::validation
        click ProfileVal "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Requests/ProfileUpdateRequest.php"
        LoginVal["Login Request"]:::validation
        click LoginVal "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Requests/Auth/LoginRequest.php"
    end

    subgraph Models
        GameM["Game Model"]:::model
        click GameM "https://github.com/Maxx2001/Dartzz/blob/master/app/Models/Game.php"
        PlayerM["Player Model"]:::model
        click PlayerM "https://github.com/Maxx2001/Dartzz/blob/master/app/Models/Player.php"
        TurnM["Turn Model"]:::model
        click TurnM "https://github.com/Maxx2001/Dartzz/blob/master/app/Models/Turn.php"
        UserM["User Model"]:::model
        click UserM "https://github.com/Maxx2001/Dartzz/blob/master/app/Models/User.php"
    end

    subgraph Resources
        GameResource["Game Resource"]:::resource
        click GameResource "https://github.com/Maxx2001/Dartzz/blob/master/app/Http/Resources/GameResource.php"
    end

    subgraph Database
        MariaDB[(MariaDB)]:::database
        click MariaDB "https://github.com/Maxx2001/Dartzz/tree/master/docker/mariadb/"
        UsersTable[("Users Table")]:::table
        click UsersTable "https://github.com/Maxx2001/Dartzz/blob/master/database/migrations/0001_01_01_000000_create_users_table.php"
        GamesTable[("Games Table")]:::table
        click GamesTable "https://github.com/Maxx2001/Dartzz/blob/master/database/migrations/2024_06_14_071917_create_games_table.php"
        PlayersTable[("Players Table")]:::table
        click PlayersTable "https://github.com/Maxx2001/Dartzz/blob/master/database/migrations/2024_06_14_071853_create_players_table.php"
        TurnsTable[("Turns Table")]:::table
        click TurnsTable "https://github.com/Maxx2001/Dartzz/blob/master/database/migrations/2024_06_14_071922_create_turns_table.php"
    end

    subgraph Infrastructure
        Docker["Docker"]:::infra
        click Docker "https://github.com/Maxx2001/Dartzz/blob/master/docker-compose.yml"
        Cache["Cache System"]:::infra
        click Cache "https://github.com/Maxx2001/Dartzz/blob/master/config/cache.php"
        Queue["Queue System"]:::infra
        click Queue "https://github.com/Maxx2001/Dartzz/blob/master/config/queue.php"
        GameRules["Game Rules"]:::infra
        click GameRules "https://github.com/Maxx2001/Dartzz/blob/master/config/gameRules.php"
        AuthRoutes["Auth Routes"]:::infra
        click AuthRoutes "https://github.com/Maxx2001/Dartzz/blob/master/routes/auth.php"
    end

    Browser --> VuePages
    VuePages --> SignInPage & TurnCreatePage
    SignInPage & TurnCreatePage --> MainLayout
    SignInPage & TurnCreatePage --> FormComponents
    VuePages --> Inertia

    Inertia --> GameC & TurnC & ProfileC
    GameC --> GameVal
    TurnC --> TurnVal
    ProfileC --> ProfileVal
    GameC --> GameActions
    TurnC --> TurnActions
    
    GameActions & TurnActions --> GameM & PlayerM & TurnM
    GameM & PlayerM & TurnM --> MariaDB
    MariaDB --> UsersTable & GamesTable & PlayersTable & TurnsTable

    GameC & TurnC --> GameResource
    GameResource --> Inertia

    AuthRoutes --> LoginVal
    LoginVal --> UserM

    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef frontend fill:#69c,stroke:#333,stroke-width:1px
    classDef controller fill:#396,stroke:#333,stroke-width:1px
    classDef action fill:#3c9,stroke:#333,stroke-width:1px
    classDef validation fill:#f93,stroke:#333,stroke-width:1px
    classDef model fill:#c69,stroke:#333,stroke-width:1px
    classDef resource fill:#9c6,stroke:#333,stroke-width:1px
    classDef database fill:#fc3,stroke:#333,stroke-width:1px
    classDef table fill:#cf9,stroke:#333,stroke-width:1px
    classDef infra fill:#c3c,stroke:#333,stroke-width:1px
```
