# ragemp-pro/classic-gamemode architecture

> Architecture diagram of the GitHub repository ragemp-pro/classic-gamemode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ragemp-pro/classic-gamemode
- Repository: https://github.com/ragemp-pro/classic-gamemode

## Overview

##### Client-side scripts (found under “client_files”)
- Contains numerous modules (NPC, taxi, police, chat, banking, etc.) that run on the client.
- Also includes browser assets (HTML, CSS, JS, images, fonts) that suggest an in-game or external GUI.
- The structure under “client_files/browser” implies that the game mode offers an interactive web-like interface integrated into the game environment.

##### Server-side (packages)
- Organized into many submodules (one for each game feature such as “carmarket”, “changelist”, “characterInit”, “economy”, “driving”, “police”, etc.).
- Every package has its own “commands”, “events”, and in many cases, a “db” folder with models. This indicates a modular approach where each feature is handled as an independent component, responding to events and commands, and interfacing with the database as required.
- The “packages” directory thus represents the server logic that governs game behavior, interactions, and persistence.

##### React-based Frontend (react)
- A separate directory fully dedicated to a modern React web-app.
- Contains typical React setup including “src”, “public”, “config” and build scripts.
- Likely serves as a separate administrative or player interface (or both), allowing players or administrators to interact with the gamemode through a web-based dashboard or in-game browser.

A. Identify the main components and label them clearly:
- Game Client Layer (client_files):
- Subdivide into in-game “client modules” (e.g., taxi, police, chat, etc.) and the browser-based UI (client_files/browser).
- Server-Side Logic (packages):
- Package as a module or a group of modules by responsibility (e.g., Economy, Administration, Character Initialization, etc.).
- “db” connections within packages where models are defined, highlighting these as database integration points.
- Web Frontend (react):
- Treat as a standalone UI component that interacts with the backend (could be for admin controls, additional user interfaces, etc.).
- Shared and Common Resources:
- “node_modules”, “package.json”, and build scripts (babel, webpack, etc.) that support both client and server parts.

B. Show clear relationships and interactions:
- Web frontend’s interaction (using RESTful API calls or sockets) with the server logic.
- If applicable, illustrate database interactions from specific server modules (the “db” folders across packages) to an abstract “Database” component.
- Use connectors to represent shared utility modules (found in “client_files/utils” and “packages/utils”) that may assist in cross-module communication.

C. Emphasize important architectural patterns:
- Modular/Plugin Architecture – Each feature (e.g., “bank”, “police”, “housing”, “taxi”) is implemented as an independent module with its own event and command logic.
- Separation of Concerns – The outline clearly separates the client code from server logic and the React-based web interface.
- Event-Driven Communication – Many modules have event handlers and command implementations, so highlighting an “Event Bus” or similar pattern (even if implicit) can be useful.

D. Include key technologies and frameworks:
- JavaScript (Node.js) is used extensively on both client and server sides.
- React and its ecosystem for the web frontend.
- Build tools/configuration files such as Babel, Webpack, and custom scripts (e.g., in “scripts” and top-level configuration files).

- For a full-stack application like this:
- How the game client modules send commands to the server packages (using events, RPC calls, or similar patterns) and how the server modules interact with the underlying database.
- For each module, label it by its functionality (e.g., “Taxi Module”, “Banking Module”, “Character Initialization”) and group related modules accordingly.

- Provide clear labels for each component or module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Game Client Layer"
        c1["NPC Module"]:::client
        c2["Taxi Module"]:::client
        c3["Police Module"]:::client
        c4["Chat Module"]:::client
        c5["Bank Module"]:::client
        c6["Browser UI"]:::client
    end

    c1 --> eBus
    c2 --> eBus
    c3 --> eBus
    c4 --> eBus
    c5 --> eBus
    c6 --> eBus

    eBus["Event Bus"]:::communication

    subgraph "Server-Side Modules"
        s1["Carmarket Module"]:::server
        s2["Character Initialization Module"]:::server
        s3["Economy Module"]:::server
        s4["Police Module (Server)"]:::server
        s5["Banking Module (Server)"]:::server
        subgraph "Database Integration"
            db1["Character Init DB"]:::db
            db2["Bank DB"]:::db
        end
    end

    eBus -->|"dispatch"| s1
    eBus -->|"dispatch"| s2
    eBus -->|"dispatch"| s3
    eBus -->|"dispatch"| s4
    eBus -->|"dispatch"| s5

    s2 --> db1
    s5 --> db2

    subgraph "React Frontend"
        r1["React Web Interface"]:::react
    end

    r1 -->|"APIcalls"| eBus

    subgraph "Shared Resources"
        sh1["node_modules"]:::shared
        sh2["package.json"]:::shared
        sh3[".babelrc"]:::shared
        sh4["scripts"]:::shared
        sh5["webpack.config.js"]:::shared
    end

    sh1 --- c1
    sh2 --- c2
    sh3 --- s1
    sh4 --- s2
    sh5 --- s3

    click c1 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/NPC"
    click c2 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/taxi"
    click c3 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/police"
    click c4 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/chat"
    click c5 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/bank"
    click c6 "https://github.com/ragemp-pro/classic-gamemode/tree/master/client_files/browser"
    click s1 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/carmarket"
    click s2 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/characterInit"
    click s3 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/economy"
    click s4 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/police"
    click s5 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/bank"
    click db1 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/characterInit/db"
    click db2 "https://github.com/ragemp-pro/classic-gamemode/tree/master/packages/bank/db"
    click r1 "https://github.com/ragemp-pro/classic-gamemode/tree/master/react"
    click sh1 "https://github.com/ragemp-pro/classic-gamemode/tree/master/node_modules"
    click sh2 "https://github.com/ragemp-pro/classic-gamemode/blob/master/package.json"
    click sh3 "https://github.com/ragemp-pro/classic-gamemode/blob/master/.babelrc"
    click sh4 "https://github.com/ragemp-pro/classic-gamemode/tree/master/scripts"
    click sh5 "https://github.com/ragemp-pro/classic-gamemode/blob/master/webpack.config.js"

    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef server fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef db fill:#FFCCCB,stroke:#000,stroke-width:2px;
    classDef react fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef shared fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef communication fill:#FFFF99,stroke:#000,stroke-width:2px;
```
