# reddragonelite/rde_phone architecture

> Architecture diagram of the GitHub repository reddragonelite/rde_phone, 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/reddragonelite/rde_phone
- Repository: https://github.com/reddragonelite/rde_phone

## Overview

rde_phone is a FiveM phone operating system for ox_core servers. A player uses the phone item or keybind; the client opens the phone only after the server-side possession gate, then the NUI shell loads registered apps in sandboxed iframes. Apps use the SDK to request server-backed actions, while the shell handles launch, notifications, settings, calls, and localization. Built-in app pages cover calls, SMS, contacts, camera, gallery, and settings. The README documents integrations and capabilities not visible in the sampled source; those links are cited as documentation, not as inspected implementation.

Main entry points: [`web/js/phone.js`](https://github.com/reddragonelite/rde_phone/blob/main/web/js/phone.js) (Shell Controller), [`web/sdk/rde-phone-sdk.js`](https://github.com/reddragonelite/rde_phone/blob/main/web/sdk/rde-phone-sdk.js) (App SDK), [`server/server.lua`](https://github.com/reddragonelite/rde_phone/blob/main/server/server.lua) (Server Runtime), [`web/index.html`](https://github.com/reddragonelite/rde_phone/blob/main/web/index.html) (Phone Shell UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["FiveM Runtime"]
  node_client["Client Runtime<br/>[client.lua]"]
  node_server["Server Runtime<br/>[server.lua]"]
  node_config["Configuration and Locales<br/>[config.lua]"]
end

subgraph group_shell["Phone Shell"]
  node_shell_ui["Phone Shell UI<br/>[index.html]"]
  node_shell_logic["Shell Controller<br/>[phone.js]"]
  node_shell_style["Phone Styling<br/>[phone.css]"]
  node_sdk["App SDK<br/>[rde-phone-sdk.js]"]
  node_audio["Tone Generator<br/>[rdui-audio.js]"]
end

subgraph group_apps["Built-in Apps"]
  node_app_calls["Calls App<br/>[index.html]"]
  node_app_sms["SMS App<br/>[index.html]"]
  node_app_contacts["Contacts App<br/>[index.html]"]
  node_app_camera["Camera App<br/>[index.html]"]
  node_app_gallery["Gallery App<br/>[index.html]"]
  node_app_settings["Settings App<br/>[index.html]"]
end

subgraph group_services["Services and Integrations"]
  node_phone_item["Phone Item<br/>[items.lua]"]
  node_voice["pma-voice"]
  node_capture["screenshot-basic"]
  node_database[("SQL Storage")]
  node_inventory["ox_inventory"]
end

node_player(("Player"))

node_player -->|"uses"| node_phone_item
node_phone_item -->|"opens phone"| node_client
node_client -->|"checks possession"| node_server
node_server -->|"opens NUI"| node_shell_ui
node_shell_ui -->|"loads controller"| node_shell_logic
node_shell_logic -->|"sends NUI requests"| node_server
node_shell_logic -->|"relays app requests"| node_sdk
node_sdk -->|"posts app messages"| node_shell_logic
node_shell_logic -->|"launches registered apps"| node_app_calls
node_shell_logic -->|"launches registered apps"| node_app_sms
node_shell_logic -->|"launches registered apps"| node_app_contacts
node_shell_logic -->|"launches registered apps"| node_app_camera
node_shell_logic -->|"launches registered apps"| node_app_gallery
node_shell_logic -->|"launches registered apps"| node_app_settings
node_app_calls -->|"uses SDK"| node_sdk
node_app_sms -->|"uses SDK"| node_sdk
node_app_contacts -->|"uses SDK"| node_sdk
node_app_camera -->|"uses SDK"| node_sdk
node_app_gallery -->|"uses SDK"| node_sdk
node_app_settings -->|"uses SDK"| node_sdk
node_server -->|"creates tables"| node_database
node_server -->|"manages call channels"| node_voice
node_server -->|"checks phone possession"| node_inventory
node_app_camera -->|"captures images"| node_capture
node_shell_logic -->|"plays tones"| node_audio
node_app_settings -->|"previews tones"| node_audio
node_config -->|"provides locale data"| node_shell_logic
node_config -->|"provides locale data"| node_sdk
node_shell_ui -.->|"loads styles"| node_shell_style

click node_phone_item "https://github.com/reddragonelite/rde_phone/blob/main/data/items.lua"
click node_client "https://github.com/reddragonelite/rde_phone/blob/main/client/client.lua"
click node_server "https://github.com/reddragonelite/rde_phone/blob/main/server/server.lua"
click node_config "https://github.com/reddragonelite/rde_phone/blob/main/config.lua"
click node_shell_ui "https://github.com/reddragonelite/rde_phone/blob/main/web/index.html"
click node_shell_logic "https://github.com/reddragonelite/rde_phone/blob/main/web/js/phone.js"
click node_shell_style "https://github.com/reddragonelite/rde_phone/blob/main/web/css/phone.css"
click node_sdk "https://github.com/reddragonelite/rde_phone/blob/main/web/sdk/rde-phone-sdk.js"
click node_audio "https://github.com/reddragonelite/rde_phone/blob/main/web/theme/rdui-audio.js"
click node_app_calls "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/calls/index.html"
click node_app_sms "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/sms/index.html"
click node_app_contacts "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/contacts/index.html"
click node_app_camera "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/camera/index.html"
click node_app_gallery "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/gallery/index.html"
click node_app_settings "https://github.com/reddragonelite/rde_phone/blob/main/web/apps/settings/index.html"

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_client,node_server,node_config toneBlue
class node_shell_ui,node_shell_logic,node_shell_style,node_sdk,node_audio toneAmber
class node_app_calls,node_app_sms,node_app_contacts,node_app_camera,node_app_gallery,node_app_settings toneMint
class node_phone_item,node_voice,node_capture,node_database,node_inventory toneRose
class node_player toneIndigo
```

## Components

### FiveM Runtime

- [Client Runtime](https://github.com/reddragonelite/rde_phone/blob/main/client/client.lua): `client/client.lua`
- [Server Runtime](https://github.com/reddragonelite/rde_phone/blob/main/server/server.lua): `server/server.lua`
- [Configuration and Locales](https://github.com/reddragonelite/rde_phone/blob/main/config.lua): `config.lua`

### Phone Shell

- [Phone Shell UI](https://github.com/reddragonelite/rde_phone/blob/main/web/index.html): `web/index.html`
- [Shell Controller](https://github.com/reddragonelite/rde_phone/blob/main/web/js/phone.js): `web/js/phone.js`
- [Phone Styling](https://github.com/reddragonelite/rde_phone/blob/main/web/css/phone.css): `web/css/phone.css`
- [App SDK](https://github.com/reddragonelite/rde_phone/blob/main/web/sdk/rde-phone-sdk.js): `web/sdk/rde-phone-sdk.js`
- [Tone Generator](https://github.com/reddragonelite/rde_phone/blob/main/web/theme/rdui-audio.js): `web/theme/rdui-audio.js`

### Built-in Apps

- [Calls App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/calls/index.html): `web/apps/calls/index.html`
- [SMS App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/sms/index.html): `web/apps/sms/index.html`
- [Contacts App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/contacts/index.html): `web/apps/contacts/index.html`
- [Camera App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/camera/index.html): `web/apps/camera/index.html`
- [Gallery App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/gallery/index.html): `web/apps/gallery/index.html`
- [Settings App](https://github.com/reddragonelite/rde_phone/blob/main/web/apps/settings/index.html): `web/apps/settings/index.html`

### Services and Integrations

- [Phone Item](https://github.com/reddragonelite/rde_phone/blob/main/data/items.lua): `data/items.lua`
- **pma-voice**
- **screenshot-basic**
- **SQL Storage**
- **ox_inventory**

### Other components

- **Player**

## Connections

- Player → Phone Item: uses (evidence: `README.md`)
- Phone Item → Client Runtime: opens phone (evidence: `README.md`)
- Client Runtime → Server Runtime: checks possession (evidence: `README.md`)
- Server Runtime → Phone Shell UI: opens NUI (evidence: `README.md`)
- Phone Shell UI → Shell Controller: loads controller (evidence: `README.md`)
- Shell Controller → Server Runtime: sends NUI requests (evidence: `web/js/phone.js`)
- Shell Controller → App SDK: relays app requests (evidence: `web/js/phone.js`)
- App SDK → Shell Controller: posts app messages (evidence: `web/sdk/rde-phone-sdk.js`)
- Shell Controller → Calls App: launches registered apps (evidence: `README.md`)
- Shell Controller → SMS App: launches registered apps (evidence: `README.md`)
- Shell Controller → Contacts App: launches registered apps (evidence: `README.md`)
- Shell Controller → Camera App: launches registered apps (evidence: `README.md`)
- Shell Controller → Gallery App: launches registered apps (evidence: `README.md`)
- Shell Controller → Settings App: launches registered apps (evidence: `README.md`)
- Calls App → App SDK: uses SDK (evidence: `README.md`)
- SMS App → App SDK: uses SDK (evidence: `README.md`)
- Contacts App → App SDK: uses SDK (evidence: `README.md`)
- Camera App → App SDK: uses SDK (evidence: `README.md`)
- Gallery App → App SDK: uses SDK (evidence: `README.md`)
- Settings App → App SDK: uses SDK (evidence: `README.md`)
- Server Runtime → SQL Storage: creates tables (evidence: `README.md`)
- Server Runtime → pma-voice: manages call channels (evidence: `README.md`)
- Server Runtime → ox_inventory: checks phone possession (evidence: `README.md`)
- Camera App → screenshot-basic: captures images (evidence: `README.md`)
- Shell Controller → Tone Generator: plays tones (evidence: `web/theme/rdui-audio.js`)
- Settings App → Tone Generator: previews tones (evidence: `web/theme/rdui-audio.js`)
- Configuration and Locales → Shell Controller: provides locale data (evidence: `README.md`)
- Configuration and Locales → App SDK: provides locale data (evidence: `web/sdk/rde-phone-sdk.js`)
- Phone Shell UI → Phone Styling: loads styles
