# lucagrp06/fivem architecture

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

- Interactive diagram: https://gitdiagram.com/lucagrp06/fivem
- Repository: https://github.com/lucagrp06/fivem

## Overview

Cfx.re is a family of PC game modification frameworks—FiveM and RedM—plus the FXServer multiplayer server. The broad user journey is launching a modified game, running resource scripts against game capabilities, and communicating with multiplayer services. The source index provides concrete evidence for parts of the CLR scripting and interop runtime; the README documents the product scope and networking approach. Many other listed subsystems are unsampled, so their internal connections are left out rather than inferred.

Main entry points: [`code/client/clrcore-v2/ScriptInterface.cs`](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/ScriptInterface.cs) (Script host interface), [`code/client/launcher/Main.cpp`](https://github.com/lucagrp06/fivem/blob/master/code/client/launcher/Main.cpp) (Game launcher), [`code/components/citizen-game-main/src/Component.cpp`](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-game-main/src/Component.cpp) (Game components), [`code/components/citizen-resources-core/src/ResourceManager.cpp`](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-core/src/ResourceManager.cpp) (Resource manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and game"]
  node_launcher["Game launcher<br/>[Main.cpp]"]
  node_game["Modified game"]
end

subgraph group_runtime["Game runtime"]
  node_game_components["Game components<br/>[Component.cpp]"]
  node_rage_scripting["RAGE scripting<br/>[scrEngine.cpp]"]
  node_game_api["Game script API<br/>[Tasks.cs]"]
end

subgraph group_scripting["Script runtime"]
  node_resource_manager["Resource manager"]
  node_resource_client["Client resources<br/>[Component.cpp]"]
  node_script_manager["Script manager<br/>[ScriptManager.cs]"]
  node_script_interface["Script host interface<br/>[ScriptInterface.cs]"]
  node_scheduler["Coroutine scheduler<br/>[Scheduler.cs]"]
  node_exports["Script exports<br/>[ExportsManager.cs]"]
  node_events["Script events<br/>[Events.cs]"]
end

subgraph group_multiplayer["Multiplayer services"]
  node_server_launcher["Server launcher<br/>[Main.cpp]"]
  node_server["FXServer<br/>[Server.cpp]"]
  node_resource_events["Resource events"]
  node_chat["Chat interface<br/>[App.ts]"]
end

node_player(("Player"))

node_player -.->|"starts game"| node_launcher
node_launcher -.->|"launches"| node_game
node_game -.->|"hosts modification"| node_game_components
node_game_components -.->|"uses scripting hooks"| node_rage_scripting
node_script_interface -->|"initializes and updates"| node_scheduler
node_script_interface -->|"initializes"| node_exports
node_script_interface -.->|"dispatches events"| node_events
node_script_manager -->|"loads scripts into"| node_script_interface
node_resource_client -.->|"manages client resources"| node_resource_manager
node_resource_manager -.->|"loads resource scripts"| node_script_manager
node_game_api -.->|"calls game natives"| node_game
node_player -.->|"connects to multiplayer"| node_server_launcher
node_server_launcher -.->|"starts server"| node_server
node_server -.->|"hosts resource events"| node_resource_events
node_chat -.->|"exchanges events"| node_resource_events

click node_launcher "https://github.com/lucagrp06/fivem/blob/master/code/client/launcher/Main.cpp"
click node_game_components "https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-game-main/src/Component.cpp"
click node_rage_scripting "https://github.com/lucagrp06/fivem/blob/master/code/components/rage-scripting-five/src/scrEngine.cpp"
click node_game_api "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore/External/Tasks.cs"
click node_resource_manager "https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-core/src/ResourceManager.cpp"
click node_resource_client "https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-client/src/Component.cpp"
click node_script_manager "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/ScriptManager.cs"
click node_script_interface "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/ScriptInterface.cs"
click node_scheduler "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Coroutine/Scheduler.cs"
click node_exports "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Interop/ExportsManager.cs"
click node_events "https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Interop/Events.cs"
click node_server_launcher "https://github.com/lucagrp06/fivem/blob/master/code/server/launcher/src/Main.cpp"
click node_server "https://github.com/lucagrp06/fivem/blob/master/code/server/launcher/src/Server.cpp"
click node_resource_events "https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-core/src/ResourceEventComponent.cpp"
click node_chat "https://github.com/lucagrp06/fivem/blob/master/ext/system-resources/resources/chat/html/App.ts"

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_launcher,node_game toneBlue
class node_game_components,node_rage_scripting,node_game_api toneAmber
class node_resource_manager,node_resource_client,node_script_manager,node_script_interface,node_scheduler,node_exports,node_events toneMint
class node_server_launcher,node_server,node_resource_events,node_chat toneRose
class node_player toneIndigo
```

## Components

### Launch and game

- [Game launcher](https://github.com/lucagrp06/fivem/blob/master/code/client/launcher/Main.cpp): `code/client/launcher/Main.cpp`
- **Modified game**

### Game runtime

- [Game components](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-game-main/src/Component.cpp): `code/components/citizen-game-main/src/Component.cpp`
- [RAGE scripting](https://github.com/lucagrp06/fivem/blob/master/code/components/rage-scripting-five/src/scrEngine.cpp): `code/components/rage-scripting-five/src/scrEngine.cpp`
- [Game script API](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore/External/Tasks.cs): `code/client/clrcore/External/Tasks.cs`

### Script runtime

- [Resource manager](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-core/src/ResourceManager.cpp): `code/components/citizen-resources-core/src/ResourceManager.cpp`
- [Client resources](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-client/src/Component.cpp): `code/components/citizen-resources-client/src/Component.cpp`
- [Script manager](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/ScriptManager.cs): `code/client/clrcore-v2/ScriptManager.cs`
- [Script host interface](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/ScriptInterface.cs): `code/client/clrcore-v2/ScriptInterface.cs`
- [Coroutine scheduler](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Coroutine/Scheduler.cs): `code/client/clrcore-v2/Coroutine/Scheduler.cs`
- [Script exports](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Interop/ExportsManager.cs): `code/client/clrcore-v2/Interop/ExportsManager.cs`
- [Script events](https://github.com/lucagrp06/fivem/blob/master/code/client/clrcore-v2/Interop/Events.cs): `code/client/clrcore-v2/Interop/Events.cs`

### Multiplayer services

- [Server launcher](https://github.com/lucagrp06/fivem/blob/master/code/server/launcher/src/Main.cpp): `code/server/launcher/src/Main.cpp`
- [FXServer](https://github.com/lucagrp06/fivem/blob/master/code/server/launcher/src/Server.cpp): `code/server/launcher/src/Server.cpp`
- [Resource events](https://github.com/lucagrp06/fivem/blob/master/code/components/citizen-resources-core/src/ResourceEventComponent.cpp): `code/components/citizen-resources-core/src/ResourceEventComponent.cpp`
- [Chat interface](https://github.com/lucagrp06/fivem/blob/master/ext/system-resources/resources/chat/html/App.ts): `ext/system-resources/resources/chat/html/App.ts`

### Other components

- **Player**

## Connections

- Player → Game launcher: starts game
- Game launcher → Modified game: launches
- Modified game → Game components: hosts modification
- Game components → RAGE scripting: uses scripting hooks
- Script host interface → Coroutine scheduler: initializes and updates (evidence: `code/client/clrcore-v2/ScriptInterface.cs`)
- Script host interface → Script exports: initializes (evidence: `code/client/clrcore-v2/ScriptInterface.cs`)
- Script host interface → Script events: dispatches events
- Script manager → Script host interface: loads scripts into (evidence: `code/client/clrcore-v2/ScriptManager.cs`)
- Client resources → Resource manager: manages client resources
- Resource manager → Script manager: loads resource scripts
- Game script API → Modified game: calls game natives
- Player → Server launcher: connects to multiplayer
- Server launcher → FXServer: starts server
- FXServer → Resource events: hosts resource events
- Chat interface → Resource events: exchanges events
