# runvicm/runpi-rathrest architecture

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

- Interactive diagram: https://gitdiagram.com/runvicm/runpi-rathrest
- Repository: https://github.com/runvicm/runpi-rathrest

## Overview

rAthReST is a Laravel API for rAthena account and server data, with a separate React reference client. The main workflow is account registration or login, followed by authenticated account and character views; public endpoints also expose API information and server status/statistics. Laravel controllers handle requests and Eloquent models represent game data. The README documents broader ambitions, but storage and several profile/admin functions are unfinished or only represented in client navigation. Client-to-API usage is documented generally; specific client request wiring is not established by the excerpts.

Main entry points: [`src/rathrest/routes/api.php`](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/routes/api.php) (API routes), [`src/rathrest/app/Http/Controllers/ServerStatController.php`](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/ServerStatController.php) (Server status and stats), [`src/rathrest/app/Models/Char.php`](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Char.php) (Character model), [`src/rathrest/app/Models/Login.php`](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Login.php) (Login model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["API routing"]
  node_api_routes["API routes<br/>[api.php]"]
  node_api_info["API information"]
  node_base_controller["Base controller<br/>[Controller.php]"]
end

subgraph group_identity["Identity and accounts"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_account["Account views"]
  node_login_model["Login model<br/>[Login.php]"]
end

subgraph group_game["Game data and status"]
  node_char_model["Character model<br/>[Char.php]"]
  node_guild_model["Guild model<br/>[Guild.php]"]
  node_server_stats["Server status and stats"]
end

subgraph group_client["Reference client"]
  node_client_root["Client application<br/>[root.tsx]"]
  node_auth_hook["Auth state hook<br/>[useAuth.ts]"]
  node_login_page["Login and registration<br/>[login.tsx]"]
  node_register_page["Registration page<br/>[register.tsx]"]
  node_account_page["Account details<br/>[view.tsx]"]
  node_characters_page["Character list<br/>[characters.tsx]"]
  node_storage_page["Storage page<br/>[storage.tsx]"]
  node_server_page["Server information<br/>[server-info.tsx]"]
end

node_user(("Website user"))
node_ro_database[("rAthena database")]
node_game_servers["rAthena services"]

node_user -->|"uses"| node_client_root
node_client_root -.->|"uses API"| node_api_routes
node_api_routes -->|"routes to"| node_api_info
node_api_routes -->|"routes to"| node_auth
node_api_routes -->|"routes to"| node_account
node_api_routes -->|"routes to"| node_server_stats
node_auth -->|"creates and checks"| node_login_model
node_account -->|"reads account"| node_login_model
node_account -->|"reads characters"| node_char_model
node_char_model -->|"loads guild"| node_guild_model
node_server_stats -->|"counts accounts"| node_login_model
node_server_stats -->|"counts characters"| node_char_model
node_login_model -.->|"maps table"| node_ro_database
node_char_model -.->|"maps table"| node_ro_database
node_guild_model -.->|"maps table"| node_ro_database
node_server_stats -->|"probes services"| node_game_servers
node_user -->|"signs in"| node_login_page
node_user -->|"registers"| node_register_page
node_user -->|"views account"| node_account_page
node_user -.->|"views characters"| node_characters_page
node_user -.->|"views storage"| node_storage_page
node_user -.->|"checks status"| node_server_page
node_auth_hook -.->|"uses API"| node_api_routes

click node_api_routes "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/routes/api.php"
click node_api_info "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/IndexController.php"
click node_base_controller "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/Controller.php"
click node_auth "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/AuthController.php"
click node_account "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/AccountController.php"
click node_login_model "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Login.php"
click node_char_model "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Char.php"
click node_guild_model "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Guild.php"
click node_server_stats "https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/ServerStatController.php"
click node_client_root "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/root.tsx"
click node_auth_hook "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/hooks/useAuth.ts"
click node_login_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/auth/login.tsx"
click node_register_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/auth/register.tsx"
click node_account_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/view.tsx"
click node_characters_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/characters.tsx"
click node_storage_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/storage.tsx"
click node_server_page "https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/server-info.tsx"

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_api_routes,node_api_info,node_base_controller,node_user toneBlue
class node_auth,node_account,node_login_model,node_ro_database toneAmber
class node_char_model,node_guild_model,node_server_stats toneMint
class node_client_root,node_auth_hook,node_login_page,node_register_page,node_account_page,node_characters_page,node_storage_page,node_server_page toneRose
class node_game_servers toneIndigo
```

## Components

### API routing

- [API routes](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/routes/api.php): `src/rathrest/routes/api.php`
- [API information](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/IndexController.php): `src/rathrest/app/Http/Controllers/IndexController.php`
- [Base controller](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/Controller.php): `src/rathrest/app/Http/Controllers/Controller.php`

### Identity and accounts

- [Authentication](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/AuthController.php): `src/rathrest/app/Http/Controllers/AuthController.php`
- [Account views](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/AccountController.php): `src/rathrest/app/Http/Controllers/AccountController.php`
- [Login model](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Login.php): `src/rathrest/app/Models/Login.php`

### Game data and status

- [Character model](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Char.php): `src/rathrest/app/Models/Char.php`
- [Guild model](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Models/Guild.php): `src/rathrest/app/Models/Guild.php`
- [Server status and stats](https://github.com/runvicm/runpi-rathrest/blob/main/src/rathrest/app/Http/Controllers/ServerStatController.php): `src/rathrest/app/Http/Controllers/ServerStatController.php`

### Reference client

- [Client application](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/root.tsx): `src/cp/app/root.tsx`
- [Auth state hook](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/hooks/useAuth.ts): `src/cp/app/hooks/useAuth.ts`
- [Login and registration](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/auth/login.tsx): `src/cp/app/routes/auth/login.tsx`
- [Registration page](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/auth/register.tsx): `src/cp/app/routes/auth/register.tsx`
- [Account details](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/view.tsx): `src/cp/app/routes/account/view.tsx`
- [Character list](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/characters.tsx): `src/cp/app/routes/account/characters.tsx`
- [Storage page](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/account/storage.tsx): `src/cp/app/routes/account/storage.tsx`
- [Server information](https://github.com/runvicm/runpi-rathrest/blob/main/src/cp/app/routes/server-info.tsx): `src/cp/app/routes/server-info.tsx`

### Other components

- **Website user**
- **rAthena database**
- **rAthena services**

## Connections

- Website user → Client application: uses
- Client application → API routes: uses API
- API routes → API information: routes to (evidence: `src/rathrest/routes/api.php`)
- API routes → Authentication: routes to (evidence: `src/rathrest/routes/api.php`)
- API routes → Account views: routes to (evidence: `src/rathrest/routes/api.php`)
- API routes → Server status and stats: routes to (evidence: `src/rathrest/routes/api.php`)
- Authentication → Login model: creates and checks (evidence: `src/rathrest/app/Http/Controllers/AuthController.php`)
- Account views → Login model: reads account (evidence: `src/rathrest/app/Http/Controllers/AccountController.php`)
- Account views → Character model: reads characters (evidence: `src/rathrest/app/Http/Controllers/AccountController.php`)
- Character model → Guild model: loads guild (evidence: `src/rathrest/app/Models/Char.php`)
- Server status and stats → Login model: counts accounts (evidence: `src/rathrest/app/Http/Controllers/ServerStatController.php`)
- Server status and stats → Character model: counts characters (evidence: `src/rathrest/app/Http/Controllers/ServerStatController.php`)
- Login model → rAthena database: maps table
- Character model → rAthena database: maps table
- Guild model → rAthena database: maps table
- Server status and stats → rAthena services: probes services (evidence: `src/rathrest/app/Http/Controllers/ServerStatController.php`)
- Website user → Login and registration: signs in
- Website user → Registration page: registers
- Website user → Account details: views account
- Website user → Character list: views characters
- Website user → Storage page: views storage
- Website user → Server information: checks status (evidence: `src/cp/app/routes/server-info.tsx`)
- Auth state hook → API routes: uses API
