# aredo97/cadilax_api architecture

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

- Interactive diagram: https://gitdiagram.com/aredo97/cadilax_api
- Repository: https://github.com/aredo97/cadilax_api

## Overview

This Laravel API implements a wallet-based color-guessing game: users create an open game with a stake, another user challenges it, and the result resolves the game and updates balances and transaction records. The tree also shows account and role management, invitations, hints, guidance and inquiry support, notifications, platform settings and revenue, and audit reporting. Sampled controllers confirm key game, authentication, and user-management calls; other subsystem links reflect their listed controller/model responsibilities, not inspected call wiring.

Main entry points: [`app/Http/Controllers/api/GameInvitationsController.php`](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameInvitationsController.php) (Game Invitations), [`app/Http/Controllers/api/GameChallengerController.php`](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameChallengerController.php) (Game Challenges), [`app/Http/Controllers/auth/AuthController.php`](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/auth/AuthController.php) (Authentication), [`routes/api.php`](https://github.com/aredo97/cadilax_api/blob/main/routes/api.php) (API Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Accounts"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_users["User Management<br/>[UserController.php]"]
  node_user[("User Accounts<br/>[User.php]")]
end

subgraph group_games["Game Lifecycle"]
  node_game["Game Operations<br/>[GameController.php]"]
  node_challenge["Game Challenges"]
  node_invites["Game Invitations"]
  node_gamesdb[("Games<br/>[Game.php]")]
  node_challengers[("Challenge Records<br/>[GameChallenger.php]")]
  node_invitations[("Invitation Records<br/>[GameInvitation.php]")]
  node_hints[("Hints<br/>[Hint.php]")]
end

subgraph group_money["Wallet and Revenue"]
  node_stakes[("Stake Options<br/>[Stake.php]")]
  node_wallet[("Wallets<br/>[Wallet.php]")]
  node_transactions[("Wallet Transactions")]
  node_revenue[("Platform Revenue")]
  node_settings[("Platform Settings")]
end

subgraph group_support["Support and Operations"]
  node_guidance["Guidance Requests"]
  node_inquiries["Inquiries"]
  node_notifications["Notifications"]
  node_audit[("Audit Logs<br/>[AuditLog.php]")]
  node_dbconfig["Database Configuration<br/>[database.php]"]
end

node_player(("Player / Admin"))
node_api["API Routes<br/>[api.php]"]
node_google{{"Google OAuth"}}

node_player -->|"sends API requests"| node_api
node_api -->|"routes auth requests"| node_auth
node_api -->|"routes user requests"| node_users
node_api -->|"routes game requests"| node_game
node_api -->|"routes challenges"| node_challenge
node_api -->|"routes invitations"| node_invites
node_auth -->|"creates and finds"| node_user
node_auth -->|"creates wallet"| node_wallet
node_auth -->|"records actions"| node_audit
node_auth -->|"notifies admins"| node_notifications
node_auth -.->|"uses OAuth"| node_google
node_users -->|"reads and updates"| node_user
node_users -->|"records changes"| node_audit
node_game -->|"creates and updates"| node_gamesdb
node_game -->|"looks up stake"| node_stakes
node_game -->|"debits and refunds"| node_wallet
node_game -->|"associates hint"| node_hints
node_challenge -->|"locks and reads"| node_gamesdb
node_challenge -->|"creates challenge"| node_challengers
node_challenge -->|"debits and credits"| node_wallet
node_challenge -->|"reads fee rate"| node_settings
node_challenge -->|"collects fees"| node_revenue
node_challenge -->|"records outcomes"| node_transactions
node_invites -->|"reads invitations"| node_invitations
node_invites -->|"reads game"| node_gamesdb
node_invites -->|"creates challenge"| node_challengers
node_invites -->|"debits and credits"| node_wallet
node_invites -->|"reads fee rate"| node_settings
node_invites -->|"collects fees"| node_revenue
node_invites -->|"records outcomes"| node_transactions
node_invites -->|"notifies invitee"| node_notifications
node_dbconfig -->|"configures persistence"| node_user

click node_api "https://github.com/aredo97/cadilax_api/blob/main/routes/api.php"
click node_auth "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/auth/AuthController.php"
click node_users "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/UserController.php"
click node_user "https://github.com/aredo97/cadilax_api/blob/main/app/Models/User.php"
click node_game "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameController.php"
click node_challenge "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameChallengerController.php"
click node_invites "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameInvitationsController.php"
click node_gamesdb "https://github.com/aredo97/cadilax_api/blob/main/app/Models/Game.php"
click node_challengers "https://github.com/aredo97/cadilax_api/blob/main/app/Models/GameChallenger.php"
click node_invitations "https://github.com/aredo97/cadilax_api/blob/main/app/Models/GameInvitation.php"
click node_hints "https://github.com/aredo97/cadilax_api/blob/main/app/Models/Hint.php"
click node_stakes "https://github.com/aredo97/cadilax_api/blob/main/app/Models/Stake.php"
click node_wallet "https://github.com/aredo97/cadilax_api/blob/main/app/Models/Wallet.php"
click node_transactions "https://github.com/aredo97/cadilax_api/blob/main/app/Models/WalletTransaction.php"
click node_revenue "https://github.com/aredo97/cadilax_api/blob/main/app/Models/PlatformRevenue.php"
click node_settings "https://github.com/aredo97/cadilax_api/blob/main/app/Models/PlatformSetting.php"
click node_guidance "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GuidanceRequestsController.php"
click node_inquiries "https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/InquiryController.php"
click node_notifications "https://github.com/aredo97/cadilax_api/tree/main/app/Notifications"
click node_audit "https://github.com/aredo97/cadilax_api/blob/main/app/Models/AuditLog.php"
click node_dbconfig "https://github.com/aredo97/cadilax_api/blob/main/config/database.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_auth,node_users,node_user toneBlue
class node_game,node_challenge,node_invites,node_gamesdb,node_challengers,node_invitations,node_hints toneAmber
class node_stakes,node_wallet,node_transactions,node_revenue,node_settings,node_api toneMint
class node_guidance,node_inquiries,node_notifications,node_audit,node_dbconfig toneRose
class node_player,node_google toneIndigo
```

## Components

### Access and Accounts

- [Authentication](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/auth/AuthController.php): `app/Http/Controllers/auth/AuthController.php`
- [User Management](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/UserController.php): `app/Http/Controllers/api/UserController.php`
- [User Accounts](https://github.com/aredo97/cadilax_api/blob/main/app/Models/User.php): `app/Models/User.php`

### Game Lifecycle

- [Game Operations](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameController.php): `app/Http/Controllers/api/GameController.php`
- [Game Challenges](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameChallengerController.php): `app/Http/Controllers/api/GameChallengerController.php`
- [Game Invitations](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GameInvitationsController.php): `app/Http/Controllers/api/GameInvitationsController.php`
- [Games](https://github.com/aredo97/cadilax_api/blob/main/app/Models/Game.php): `app/Models/Game.php`
- [Challenge Records](https://github.com/aredo97/cadilax_api/blob/main/app/Models/GameChallenger.php): `app/Models/GameChallenger.php`
- [Invitation Records](https://github.com/aredo97/cadilax_api/blob/main/app/Models/GameInvitation.php): `app/Models/GameInvitation.php`
- [Hints](https://github.com/aredo97/cadilax_api/blob/main/app/Models/Hint.php): `app/Models/Hint.php`

### Wallet and Revenue

- [Stake Options](https://github.com/aredo97/cadilax_api/blob/main/app/Models/Stake.php): `app/Models/Stake.php`
- [Wallets](https://github.com/aredo97/cadilax_api/blob/main/app/Models/Wallet.php): `app/Models/Wallet.php`
- [Wallet Transactions](https://github.com/aredo97/cadilax_api/blob/main/app/Models/WalletTransaction.php): `app/Models/WalletTransaction.php`
- [Platform Revenue](https://github.com/aredo97/cadilax_api/blob/main/app/Models/PlatformRevenue.php): `app/Models/PlatformRevenue.php`
- [Platform Settings](https://github.com/aredo97/cadilax_api/blob/main/app/Models/PlatformSetting.php): `app/Models/PlatformSetting.php`

### Support and Operations

- [Guidance Requests](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/GuidanceRequestsController.php): `app/Http/Controllers/api/GuidanceRequestsController.php`
- [Inquiries](https://github.com/aredo97/cadilax_api/blob/main/app/Http/Controllers/api/InquiryController.php): `app/Http/Controllers/api/InquiryController.php`
- [Notifications](https://github.com/aredo97/cadilax_api/tree/main/app/Notifications): `app/Notifications`
- [Audit Logs](https://github.com/aredo97/cadilax_api/blob/main/app/Models/AuditLog.php): `app/Models/AuditLog.php`
- [Database Configuration](https://github.com/aredo97/cadilax_api/blob/main/config/database.php): `config/database.php`

### Other components

- **Player / Admin**
- [API Routes](https://github.com/aredo97/cadilax_api/blob/main/routes/api.php): `routes/api.php`
- **Google OAuth**

## Connections

- Player / Admin → API Routes: sends API requests
- API Routes → Authentication: routes auth requests
- API Routes → User Management: routes user requests
- API Routes → Game Operations: routes game requests
- API Routes → Game Challenges: routes challenges
- API Routes → Game Invitations: routes invitations
- Authentication → User Accounts: creates and finds
- Authentication → Wallets: creates wallet
- Authentication → Audit Logs: records actions
- Authentication → Notifications: notifies admins
- Authentication → Google OAuth: uses OAuth
- User Management → User Accounts: reads and updates
- User Management → Audit Logs: records changes
- Game Operations → Games: creates and updates
- Game Operations → Stake Options: looks up stake
- Game Operations → Wallets: debits and refunds
- Game Operations → Hints: associates hint
- Game Challenges → Games: locks and reads
- Game Challenges → Challenge Records: creates challenge
- Game Challenges → Wallets: debits and credits
- Game Challenges → Platform Settings: reads fee rate
- Game Challenges → Platform Revenue: collects fees
- Game Challenges → Wallet Transactions: records outcomes
- Game Invitations → Invitation Records: reads invitations
- Game Invitations → Games: reads game
- Game Invitations → Challenge Records: creates challenge
- Game Invitations → Wallets: debits and credits
- Game Invitations → Platform Settings: reads fee rate
- Game Invitations → Platform Revenue: collects fees
- Game Invitations → Wallet Transactions: records outcomes
- Game Invitations → Notifications: notifies invitee
- Database Configuration → User Accounts: configures persistence
