# gamehub-vinix7/web-gamehub architecture

> Architecture diagram of the GitHub repository gamehub-vinix7/web-gamehub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gamehub-vinix7/web-gamehub
- Repository: https://github.com/gamehub-vinix7/web-gamehub

## Overview

GameHub lets players browse game deals and prices, inspect platform-specific details and price history, and manage wishlists; admins can inspect synchronization status. The main flow is browser pages calling Laravel API routes, whose controllers query game, price, platform, and wishlist data and return JSON resources. Scheduled deal fetching and platform-price synchronization are documented by the command, job, and service paths, but their source was not sampled, so their internal calls are not asserted. The graph preserves those product stages while limiting edges to relationships evidenced by excerpts, the source index, or route declarations.

Main entry points: [`backend/routes/api.php`](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/routes/api.php) (API routes), [`backend/app/Models/Game.php`](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Game.php) (Games), [`backend/app/Models/Platform.php`](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Platform.php) (Platforms), [`frontend/lib/api.ts`](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Player web app"]
  node_browse["Browse games<br/>[page.tsx]"]
  node_detail["Game details<br/>[page.tsx]"]
  node_wishlist_ui["Wishlist page<br/>[page.tsx]"]
  node_admin_ui["Sync dashboard<br/>[page.tsx]"]
  node_game_card["Game cards<br/>[GameCard.tsx]"]
  node_nav["Navigation<br/>[HeaderNav.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_auth_state["Auth state<br/>[auth.tsx]"]
end

subgraph group_api["HTTP API"]
  node_api_routes["API routes<br/>[api.php]"]
  node_game_controller["Game endpoints<br/>[GameController.php]"]
  node_platform_controller["Filter options"]
  node_wishlist_controller["Wishlist endpoints"]
  node_auth_controller["Authentication<br/>[AuthController.php]"]
  node_sync_log_controller["Sync log endpoint"]
  node_game_resource["Game responses<br/>[GameResource.php]"]
  node_detail_resource["Detail responses"]
  node_sync_resource["Sync log responses"]
end

subgraph group_catalog["Game catalog and prices"]
  node_game_model["Games<br/>[Game.php]"]
  node_platform_model["Platforms<br/>[Platform.php]"]
  node_price_model["Current prices<br/>[Price.php]"]
  node_history_model["Price history<br/>[PriceHistory.php]"]
end

subgraph group_accounts["Accounts and administration"]
  node_wishlist_model["Wishlist records<br/>[Wishlist.php]"]
  node_user_model["Users<br/>[User.php]"]
end

subgraph group_sync["Deal synchronization"]
  node_sync_log_model["Sync records<br/>[SyncLog.php]"]
  node_deal_command["Fetch game deals<br/>[FetchGameDeals.php]"]
  node_price_command["Sync prices command<br/>[SyncPrices.php]"]
  node_sync_job["Platform price sync"]
  node_cheapshark["CheapShark client"]
end

node_player(("Player"))
node_admin(("Admin"))
node_cheapshark_service{{"CheapShark"}}

node_player -->|"views"| node_browse
node_player -->|"opens"| node_detail
node_player -->|"manages"| node_wishlist_ui
node_admin -->|"reviews"| node_admin_ui
node_browse -.->|"requests"| node_api_client
node_detail -.->|"requests"| node_api_client
node_wishlist_ui -.->|"requests"| node_api_client
node_admin_ui -.->|"requests"| node_api_client
node_api_client -.->|"calls"| node_api_routes
node_auth_state -->|"uses"| node_api_client
node_api_routes -->|"routes"| node_game_controller
node_api_routes -->|"routes"| node_platform_controller
node_api_routes -->|"routes"| node_wishlist_controller
node_api_routes -->|"routes"| node_auth_controller
node_api_routes -->|"routes"| node_sync_log_controller
node_game_controller -->|"queries"| node_game_model
node_game_controller -->|"filters"| node_platform_model
node_game_controller -->|"serializes"| node_game_resource
node_game_controller -->|"serializes"| node_detail_resource
node_platform_controller -->|"reads"| node_platform_model
node_platform_controller -->|"reads genres"| node_game_model
node_wishlist_controller -->|"reads and writes"| node_wishlist_model
node_wishlist_controller -->|"loads games"| node_game_model
node_auth_controller -->|"authenticates"| node_user_model
node_sync_log_controller -->|"reads"| node_sync_log_model
node_sync_log_controller -->|"serializes"| node_sync_resource
node_game_model -->|"has prices"| node_price_model
node_game_model -->|"relates platforms"| node_platform_model
node_game_model -->|"has history"| node_history_model
node_platform_model -->|"has prices"| node_price_model
node_platform_model -->|"has history"| node_history_model
node_platform_model -->|"has sync logs"| node_sync_log_model
node_user_model -->|"has wishlists"| node_wishlist_model
node_deal_command -.->|"uses"| node_cheapshark
node_cheapshark -->|"requests deals"| node_cheapshark_service
node_price_command -.->|"dispatches"| node_sync_job
node_sync_job -.->|"updates prices"| node_price_model
node_sync_job -.->|"records history"| node_history_model
node_sync_job -.->|"records status"| node_sync_log_model

click node_browse "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/page.tsx"
click node_detail "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/games/%5Bid%5D/page.tsx"
click node_wishlist_ui "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/wishlist/page.tsx"
click node_admin_ui "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/admin/page.tsx"
click node_game_card "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/components/GameCard.tsx"
click node_nav "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/components/HeaderNav.tsx"
click node_api_client "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/lib/api.ts"
click node_auth_state "https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/lib/auth.tsx"
click node_api_routes "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/routes/api.php"
click node_game_controller "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/GameController.php"
click node_platform_controller "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/PlatformController.php"
click node_wishlist_controller "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/WishlistController.php"
click node_auth_controller "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/AuthController.php"
click node_sync_log_controller "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/AdminSyncLogController.php"
click node_game_resource "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/GameResource.php"
click node_detail_resource "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/GameDetailResource.php"
click node_sync_resource "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/SyncLogResource.php"
click node_game_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Game.php"
click node_platform_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Platform.php"
click node_price_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Price.php"
click node_history_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/PriceHistory.php"
click node_wishlist_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Wishlist.php"
click node_user_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/User.php"
click node_sync_log_model "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/SyncLog.php"
click node_deal_command "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Console/Commands/FetchGameDeals.php"
click node_price_command "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Console/Commands/SyncPrices.php"
click node_sync_job "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Jobs/SyncPlatformPrices.php"
click node_cheapshark "https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Services/CheapSharkApiService.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browse,node_detail,node_wishlist_ui,node_admin_ui,node_game_card,node_nav,node_api_client,node_auth_state toneBlue
class node_api_routes,node_game_controller,node_platform_controller,node_wishlist_controller,node_auth_controller,node_sync_log_controller,node_game_resource,node_detail_resource,node_sync_resource toneAmber
class node_game_model,node_platform_model,node_price_model,node_history_model toneMint
class node_wishlist_model,node_user_model toneRose
class node_sync_log_model,node_deal_command,node_price_command,node_sync_job,node_cheapshark,node_player,node_admin,node_cheapshark_service toneIndigo
```

## Components

### Player web app

- [Browse games](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Game details](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/games/%5Bid%5D/page.tsx): `frontend/app/games/[id]/page.tsx`
- [Wishlist page](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/wishlist/page.tsx): `frontend/app/wishlist/page.tsx`
- [Sync dashboard](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/app/admin/page.tsx): `frontend/app/admin/page.tsx`
- [Game cards](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/components/GameCard.tsx): `frontend/components/GameCard.tsx`
- [Navigation](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/components/HeaderNav.tsx): `frontend/components/HeaderNav.tsx`
- [API client](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Auth state](https://github.com/gamehub-vinix7/web-gamehub/blob/master/frontend/lib/auth.tsx): `frontend/lib/auth.tsx`

### HTTP API

- [API routes](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/routes/api.php): `backend/routes/api.php`
- [Game endpoints](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/GameController.php): `backend/app/Http/Controllers/GameController.php`
- [Filter options](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/PlatformController.php): `backend/app/Http/Controllers/PlatformController.php`
- [Wishlist endpoints](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/WishlistController.php): `backend/app/Http/Controllers/WishlistController.php`
- [Authentication](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/AuthController.php): `backend/app/Http/Controllers/AuthController.php`
- [Sync log endpoint](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Controllers/AdminSyncLogController.php): `backend/app/Http/Controllers/AdminSyncLogController.php`
- [Game responses](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/GameResource.php): `backend/app/Http/Resources/GameResource.php`
- [Detail responses](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/GameDetailResource.php): `backend/app/Http/Resources/GameDetailResource.php`
- [Sync log responses](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Http/Resources/SyncLogResource.php): `backend/app/Http/Resources/SyncLogResource.php`

### Game catalog and prices

- [Games](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Game.php): `backend/app/Models/Game.php`
- [Platforms](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Platform.php): `backend/app/Models/Platform.php`
- [Current prices](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Price.php): `backend/app/Models/Price.php`
- [Price history](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/PriceHistory.php): `backend/app/Models/PriceHistory.php`

### Accounts and administration

- [Wishlist records](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/Wishlist.php): `backend/app/Models/Wishlist.php`
- [Users](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/User.php): `backend/app/Models/User.php`

### Deal synchronization

- [Sync records](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Models/SyncLog.php): `backend/app/Models/SyncLog.php`
- [Fetch game deals](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Console/Commands/FetchGameDeals.php): `backend/app/Console/Commands/FetchGameDeals.php`
- [Sync prices command](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Console/Commands/SyncPrices.php): `backend/app/Console/Commands/SyncPrices.php`
- [Platform price sync](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Jobs/SyncPlatformPrices.php): `backend/app/Jobs/SyncPlatformPrices.php`
- [CheapShark client](https://github.com/gamehub-vinix7/web-gamehub/blob/master/backend/app/Services/CheapSharkApiService.php): `backend/app/Services/CheapSharkApiService.php`

### Other components

- **Player**
- **Admin**
- **CheapShark**

## Connections

- Player → Browse games: views (evidence: `frontend/app/page.tsx`)
- Player → Game details: opens (evidence: `frontend/app/games/[id]/page.tsx`)
- Player → Wishlist page: manages (evidence: `frontend/app/wishlist/page.tsx`)
- Admin → Sync dashboard: reviews (evidence: `frontend/app/admin/page.tsx`)
- Browse games → API client: requests
- Game details → API client: requests
- Wishlist page → API client: requests
- Sync dashboard → API client: requests
- API client → API routes: calls
- Auth state → API client: uses (evidence: `frontend/lib/auth.tsx`)
- API routes → Game endpoints: routes (evidence: `backend/routes/api.php`)
- API routes → Filter options: routes (evidence: `backend/routes/api.php`)
- API routes → Wishlist endpoints: routes (evidence: `backend/routes/api.php`)
- API routes → Authentication: routes (evidence: `backend/routes/api.php`)
- API routes → Sync log endpoint: routes (evidence: `backend/routes/api.php`)
- Game endpoints → Games: queries (evidence: `backend/app/Http/Controllers/GameController.php`)
- Game endpoints → Platforms: filters (evidence: `backend/app/Http/Controllers/GameController.php`)
- Game endpoints → Game responses: serializes (evidence: `backend/app/Http/Controllers/GameController.php`)
- Game endpoints → Detail responses: serializes (evidence: `backend/app/Http/Controllers/GameController.php`)
- Filter options → Platforms: reads (evidence: `backend/app/Http/Controllers/PlatformController.php`)
- Filter options → Games: reads genres (evidence: `backend/app/Http/Controllers/PlatformController.php`)
- Wishlist endpoints → Wishlist records: reads and writes (evidence: `backend/app/Http/Controllers/WishlistController.php`)
- Wishlist endpoints → Games: loads games (evidence: `backend/app/Http/Controllers/WishlistController.php`)
- Authentication → Users: authenticates (evidence: `backend/app/Http/Controllers/AuthController.php`)
- Sync log endpoint → Sync records: reads (evidence: `backend/app/Http/Controllers/AdminSyncLogController.php`)
- Sync log endpoint → Sync log responses: serializes (evidence: `backend/app/Http/Controllers/AdminSyncLogController.php`)
- Games → Current prices: has prices (evidence: `backend/app/Models/Game.php`)
- Games → Platforms: relates platforms (evidence: `backend/app/Models/Game.php`)
- Games → Price history: has history (evidence: `backend/app/Models/Game.php`)
- Platforms → Current prices: has prices (evidence: `backend/app/Models/Platform.php`)
- Platforms → Price history: has history (evidence: `backend/app/Models/Platform.php`)
- Platforms → Sync records: has sync logs (evidence: `backend/app/Models/Platform.php`)
- Users → Wishlist records: has wishlists (evidence: `backend/app/Models/User.php`)
- Fetch game deals → CheapShark client: uses
- CheapShark client → CheapShark: requests deals (evidence: `backend/app/Services/CheapSharkApiService.php`)
- Sync prices command → Platform price sync: dispatches
- Platform price sync → Current prices: updates prices
- Platform price sync → Price history: records history
- Platform price sync → Sync records: records status
