# borsuczyna/districtmta architecture

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

- Interactive diagram: https://gitdiagram.com/borsuczyna/districtmta
- Repository: https://github.com/borsuczyna/districtmta

## Overview

districtMTA is an MTA game mode with CEF-facing gameplay systems, accompanied by a C# Discord bot and a resource compiler. The main player workflow is server-side gameplay across jobs, missions, inventory, homes and vehicle customization; the README emphasizes server-side validation rather than trusting client requests. The bot adds account linking, notifications and payment messaging, while the compiler processes MTA resources. Several gameplay modules are represented from the tree and README, but their internal calls were not sampled, so those connections are left unasserted.

Main entry points: [`[bot]/Socket/Socket.cs`](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Socket/Socket.cs) (MTA socket bridge), [`[bot]/Discord/Client.cs`](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Discord/Client.cs) (Discord commands), [`[bot]/MTA/AccountManager.cs`](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/MTA/AccountManager.cs) (Account management), [`[bot]/Tools/PaymentManager.cs`](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Tools/PaymentManager.cs) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["MTA gameplay"]
  node_factions["Factions<br/>[main.js]"]
  node_sapd["SAPD systems"]
  node_jobs["Cooperative jobs"]
  node_missions["Missions"]
  node_inventory["Inventory and crafting"]
  node_houses["Housing and furniture<br/>[main.js]"]
  node_tuning["Vehicle tuning"]
  node_dashboard["Dashboard and pass"]
end

subgraph group_cef["CEF interface"]
  node_cef["CEF UI runtime<br/>[controller.js]"]
end

subgraph group_bot["Discord bot"]
  node_bot["Bot service<br/>[Program.cs]"]
  node_discord["Discord commands<br/>[Client.cs]"]
  node_accounts["Account management<br/>[AccountManager.cs]"]
  node_rewards["Daily reward reminders"]
  node_socket["MTA socket bridge<br/>[Socket.cs]"]
  node_payment["Payment processing<br/>[PaymentManager.cs]"]
  node_compile_api["Compile endpoint"]
end

subgraph group_compiler["Resource compiler"]
  node_resource_manager["Resource manager<br/>[ResourceManager.cs]"]
  node_resource["Resource compiler<br/>[MTAResource.cs]"]
  node_scripts["Script compiler<br/>[MTAScript.cs]"]
end

node_player(("Player"))
node_mta["MTA server"]
node_stripe["Stripe"]
node_database[("SQL database")]

node_player -.->|"plays on"| node_mta
node_mta -.->|"runs gameplay"| node_jobs
node_mta -.->|"runs gameplay"| node_missions
node_mta -.->|"runs gameplay"| node_inventory
node_mta -.->|"runs gameplay"| node_houses
node_mta -.->|"runs gameplay"| node_tuning
node_mta -.->|"runs gameplay"| node_factions
node_mta -.->|"runs gameplay"| node_sapd
node_mta -.->|"runs features"| node_dashboard
node_cef -.->|"presents UI"| node_mta
node_bot -->|"starts"| node_discord
node_bot -->|"starts"| node_socket
node_discord -->|"queries account"| node_accounts
node_discord -->|"starts reminders"| node_rewards
node_rewards -->|"queries records"| node_database
node_accounts -->|"queries and updates"| node_database
node_accounts -->|"broadcasts updates"| node_socket
node_socket -->|"handles payment request"| node_payment
node_payment -->|"creates payment link"| node_stripe
node_payment -->|"broadcasts completion"| node_socket
node_mta -.->|"connects by socket"| node_socket
node_compile_api -.->|"invokes compilation"| node_resource_manager
node_resource_manager -->|"loads and compiles"| node_resource
node_resource -->|"compiles scripts"| node_scripts

click node_factions "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/%5Bfactions%5D/m-factions/data/main.js"
click node_sapd "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/%5Bfactions%5D/m-faction-sapd/data"
click node_jobs "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-jobs/data"
click node_missions "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-missions/interface/data"
click node_inventory "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-inventory/data"
click node_houses "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/m-houses/data/main.js"
click node_tuning "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-tuning/data"
click node_dashboard "https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-dashboard/data"
click node_cef "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/m-ui/data/js/controller.js"
click node_bot "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Program.cs"
click node_discord "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Discord/Client.cs"
click node_accounts "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/MTA/AccountManager.cs"
click node_rewards "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Tasks/HandleDailyRewards.cs"
click node_socket "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Socket/Socket.cs"
click node_payment "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Tools/PaymentManager.cs"
click node_compile_api "https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Controllers/CompileController.cs"
click node_resource_manager "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/ResourceManager.cs"
click node_resource "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/MTAResource.cs"
click node_scripts "https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/MTAScript.cs"

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_factions,node_sapd,node_jobs,node_missions,node_inventory,node_houses,node_tuning,node_dashboard toneBlue
class node_cef,node_database toneAmber
class node_bot,node_discord,node_accounts,node_rewards,node_socket,node_payment,node_compile_api,node_mta toneMint
class node_resource_manager,node_resource,node_scripts toneRose
class node_player,node_stripe toneIndigo
```

## Components

### MTA gameplay

- [Factions](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/%5Bfactions%5D/m-factions/data/main.js): `[serwer]/[factions]/m-factions/data/main.js`
- [SAPD systems](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/%5Bfactions%5D/m-faction-sapd/data): `[serwer]/[factions]/m-faction-sapd/data`
- [Cooperative jobs](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-jobs/data): `[serwer]/m-jobs/data`
- [Missions](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-missions/interface/data): `[serwer]/m-missions/interface/data`
- [Inventory and crafting](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-inventory/data): `[serwer]/m-inventory/data`
- [Housing and furniture](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/m-houses/data/main.js): `[serwer]/m-houses/data/main.js`
- [Vehicle tuning](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-tuning/data): `[serwer]/m-tuning/data`
- [Dashboard and pass](https://github.com/borsuczyna/districtmta/tree/main/%5Bserwer%5D/m-dashboard/data): `[serwer]/m-dashboard/data`

### CEF interface

- [CEF UI runtime](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/m-ui/data/js/controller.js): `[serwer]/m-ui/data/js/controller.js`

### Discord bot

- [Bot service](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Program.cs): `[bot]/Program.cs`
- [Discord commands](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Discord/Client.cs): `[bot]/Discord/Client.cs`
- [Account management](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/MTA/AccountManager.cs): `[bot]/MTA/AccountManager.cs`
- [Daily reward reminders](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Tasks/HandleDailyRewards.cs): `[bot]/Tasks/HandleDailyRewards.cs`
- [MTA socket bridge](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Socket/Socket.cs): `[bot]/Socket/Socket.cs`
- [Payment processing](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Tools/PaymentManager.cs): `[bot]/Tools/PaymentManager.cs`
- [Compile endpoint](https://github.com/borsuczyna/districtmta/blob/main/%5Bbot%5D/Controllers/CompileController.cs): `[bot]/Controllers/CompileController.cs`

### Resource compiler

- [Resource manager](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/ResourceManager.cs): `[serwer]/compiler/Classes/ResourceManager.cs`
- [Resource compiler](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/MTAResource.cs): `[serwer]/compiler/Classes/MTAResource.cs`
- [Script compiler](https://github.com/borsuczyna/districtmta/blob/main/%5Bserwer%5D/compiler/Classes/MTAScript.cs): `[serwer]/compiler/Classes/MTAScript.cs`

### Other components

- **Player**
- **MTA server**
- **Stripe**
- **SQL database**

## Connections

- Player → MTA server: plays on
- MTA server → Cooperative jobs: runs gameplay
- MTA server → Missions: runs gameplay
- MTA server → Inventory and crafting: runs gameplay
- MTA server → Housing and furniture: runs gameplay
- MTA server → Vehicle tuning: runs gameplay
- MTA server → Factions: runs gameplay
- MTA server → SAPD systems: runs gameplay
- MTA server → Dashboard and pass: runs features
- CEF UI runtime → MTA server: presents UI
- Bot service → Discord commands: starts (evidence: `[bot]/Program.cs`)
- Bot service → MTA socket bridge: starts (evidence: `[bot]/Program.cs`)
- Discord commands → Account management: queries account (evidence: `[bot]/Discord/Client.cs`)
- Discord commands → Daily reward reminders: starts reminders (evidence: `[bot]/Discord/Client.cs`)
- Daily reward reminders → SQL database: queries records (evidence: `[bot]/Tasks/HandleDailyRewards.cs`)
- Account management → SQL database: queries and updates (evidence: `[bot]/MTA/AccountManager.cs`)
- Account management → MTA socket bridge: broadcasts updates (evidence: `[bot]/MTA/AccountManager.cs`)
- MTA socket bridge → Payment processing: handles payment request (evidence: `[bot]/Socket/Socket.cs`)
- Payment processing → Stripe: creates payment link (evidence: `[bot]/Tools/PaymentManager.cs`)
- Payment processing → MTA socket bridge: broadcasts completion (evidence: `[bot]/Tools/PaymentManager.cs`)
- MTA server → MTA socket bridge: connects by socket
- Compile endpoint → Resource manager: invokes compilation
- Resource manager → Resource compiler: loads and compiles (evidence: `[serwer]/compiler/Classes/ResourceManager.cs`)
- Resource compiler → Script compiler: compiles scripts (evidence: `[serwer]/compiler/Classes/MTAResource.cs`)
