# mustachedom/md-drugs architecture

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

- Interactive diagram: https://gitdiagram.com/mustachedom/md-drugs
- Repository: https://github.com/mustachedom/md-drugs

## Overview

MD-Drugs is a FiveM roleplay resource for configurable drug activities, with client and server Lua modules, shared drug data, and inventory integration. The documented customization workflow is to edit shared drug data for locations, yields, and processing times, then install the matching inventory items and run the SQL. The tree shows drug-specific client/server modules, but no source excerpts were provided, so their internal calls and exact runtime flow cannot be verified; uncertain workflow links are dashed.

Main entry points: [`server`](https://github.com/mustachedom/md-drugs/tree/main/server) (Drug activities), [`client`](https://github.com/mustachedom/md-drugs/tree/main/client) (Drug interactions), [`shared/DrugData`](https://github.com/mustachedom/md-drugs/tree/main/shared/DrugData) (Drug definitions), [`shared/config.lua`](https://github.com/mustachedom/md-drugs/blob/main/shared/config.lua) (Shared settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Drug gameplay"]
  node_client_drugplay["Drug interactions"]
  node_server_drugplay["Drug activities"]
  node_merchant["Travelling merchant"]
  node_merchant_server["Merchant services"]
  node_plant_client["Plant encounters<br/>[plantSpawns.lua]"]
  node_plant_server["Plant services<br/>[plantSpawns.lua]"]
  node_consumables["Consumable use<br/>[consumables.lua]"]
  node_delivery["Drug deliveries<br/>[deliveries.lua]"]
  node_selling["Corner selling<br/>[cornerselling.lua]"]
  node_wholesale["Wholesale trade<br/>[wholesale.lua]"]
  node_oxy["Oxy runs<br/>[oxyruns.lua]"]
  node_drug_processing["Drug processing<br/>[cocaine.lua]"]
end

subgraph group_configuration["Configuration"]
  node_shared_drugdata["Drug definitions"]
  node_shared_config["Shared settings<br/>[config.lua]"]
end

subgraph group_integration["Server integration"]
  node_framework["Community bridge"]
  node_inventory[("Inventory resource")]
  node_database[("SQL database")]
end

subgraph group_assets["Game assets"]
  node_balloon_resource["Balloon resource<br/>[fxmanifest.lua]"]
  node_balloon_models["Balloon models<br/>[ate_balloon.ytyp]"]
end

node_player(("Roleplay player"))

node_player -.->|"uses"| node_client_drugplay
node_client_drugplay -.->|"requests activities"| node_server_drugplay
node_shared_drugdata -.->|"configures"| node_client_drugplay
node_shared_drugdata -.->|"configures"| node_server_drugplay
node_shared_config -.->|"configures"| node_client_drugplay
node_framework -.->|"required integration"| node_server_drugplay
node_inventory -.->|"item integration"| node_server_drugplay
node_database -.->|"SQL setup"| node_server_drugplay
node_balloon_resource -.->|"streams"| node_balloon_models

click node_client_drugplay "https://github.com/mustachedom/md-drugs/tree/main/client"
click node_server_drugplay "https://github.com/mustachedom/md-drugs/tree/main/server"
click node_shared_drugdata "https://github.com/mustachedom/md-drugs/tree/main/shared/DrugData"
click node_shared_config "https://github.com/mustachedom/md-drugs/blob/main/shared/config.lua"
click node_merchant "https://github.com/mustachedom/md-drugs/blob/main/client/TravellingMerchant.lua"
click node_merchant_server "https://github.com/mustachedom/md-drugs/blob/main/server/TravellingMerchant.lua"
click node_plant_client "https://github.com/mustachedom/md-drugs/blob/main/client/plantSpawns.lua"
click node_plant_server "https://github.com/mustachedom/md-drugs/blob/main/server/plantSpawns.lua"
click node_consumables "https://github.com/mustachedom/md-drugs/blob/main/client/consumables.lua"
click node_delivery "https://github.com/mustachedom/md-drugs/blob/main/client/deliveries.lua"
click node_selling "https://github.com/mustachedom/md-drugs/blob/main/client/cornerselling.lua"
click node_wholesale "https://github.com/mustachedom/md-drugs/blob/main/client/wholesale.lua"
click node_oxy "https://github.com/mustachedom/md-drugs/blob/main/client/oxyruns.lua"
click node_drug_processing "https://github.com/mustachedom/md-drugs/blob/main/client/cocaine.lua"
click node_balloon_resource "https://github.com/mustachedom/md-drugs/blob/main/ate_balloon/fxmanifest.lua"
click node_balloon_models "https://github.com/mustachedom/md-drugs/blob/main/ate_balloon/stream/ate_balloon.ytyp"

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_drugplay,node_server_drugplay,node_merchant,node_merchant_server,node_plant_client,node_plant_server,node_consumables,node_delivery,node_selling,node_wholesale,node_oxy,node_drug_processing toneBlue
class node_shared_drugdata,node_shared_config toneAmber
class node_framework,node_inventory,node_database toneMint
class node_balloon_resource,node_balloon_models toneRose
class node_player toneIndigo
```

## Components

### Drug gameplay

- [Drug interactions](https://github.com/mustachedom/md-drugs/tree/main/client): `client`
- [Drug activities](https://github.com/mustachedom/md-drugs/tree/main/server): `server`
- [Travelling merchant](https://github.com/mustachedom/md-drugs/blob/main/client/TravellingMerchant.lua): `client/TravellingMerchant.lua`
- [Merchant services](https://github.com/mustachedom/md-drugs/blob/main/server/TravellingMerchant.lua): `server/TravellingMerchant.lua`
- [Plant encounters](https://github.com/mustachedom/md-drugs/blob/main/client/plantSpawns.lua): `client/plantSpawns.lua`
- [Plant services](https://github.com/mustachedom/md-drugs/blob/main/server/plantSpawns.lua): `server/plantSpawns.lua`
- [Consumable use](https://github.com/mustachedom/md-drugs/blob/main/client/consumables.lua): `client/consumables.lua`
- [Drug deliveries](https://github.com/mustachedom/md-drugs/blob/main/client/deliveries.lua): `client/deliveries.lua`
- [Corner selling](https://github.com/mustachedom/md-drugs/blob/main/client/cornerselling.lua): `client/cornerselling.lua`
- [Wholesale trade](https://github.com/mustachedom/md-drugs/blob/main/client/wholesale.lua): `client/wholesale.lua`
- [Oxy runs](https://github.com/mustachedom/md-drugs/blob/main/client/oxyruns.lua): `client/oxyruns.lua`
- [Drug processing](https://github.com/mustachedom/md-drugs/blob/main/client/cocaine.lua): `client/cocaine.lua`

### Configuration

- [Drug definitions](https://github.com/mustachedom/md-drugs/tree/main/shared/DrugData): `shared/DrugData`
- [Shared settings](https://github.com/mustachedom/md-drugs/blob/main/shared/config.lua): `shared/config.lua`

### Server integration

- **Community bridge**
- **Inventory resource**
- **SQL database**

### Game assets

- [Balloon resource](https://github.com/mustachedom/md-drugs/blob/main/ate_balloon/fxmanifest.lua): `ate_balloon/fxmanifest.lua`
- [Balloon models](https://github.com/mustachedom/md-drugs/blob/main/ate_balloon/stream/ate_balloon.ytyp): `ate_balloon/stream/ate_balloon.ytyp`

### Other components

- **Roleplay player**

## Connections

- Roleplay player → Drug interactions: uses
- Drug interactions → Drug activities: requests activities
- Drug definitions → Drug interactions: configures
- Drug definitions → Drug activities: configures
- Shared settings → Drug interactions: configures
- Community bridge → Drug activities: required integration (evidence: `readme.md`)
- Inventory resource → Drug activities: item integration (evidence: `readme.md`)
- SQL database → Drug activities: SQL setup (evidence: `readme.md`)
- Balloon resource → Balloon models: streams
