# how941201/dg-rental architecture

> Architecture diagram of the GitHub repository how941201/dg-rental, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/how941201/dg-rental
- Repository: https://github.com/how941201/dg-rental

## Overview

##### Project type and purpose
- This is a FiveM “resource” (mod) built on the QBCore framework. Its sole purpose is to add an “advanced car rental” feature, letting players rent vehicles, park them in garages, and have the rental status recorded in the shared database.
- Key indicators:
- client/ and server/ folders with .lua scripts
- fxmanifest.lua (FiveM resource manifest)
- rent.sql (database schema change)
- README’s mention of qb-core, qb-target, qb-menu

##### File structure
Top-level files:
- README.md – high-level description & installation steps
- fxmanifest.lua – defines resource, tells FiveM which files to load on client vs. server
- config.lua – configurable constants (e.g., rental fees, garage locations)
- rent.sql – SQL to add a rent column to player_vehicles table
Directories:
- client/client.lua – UI and in-game interactions (spawn vehicle, park vehicle, menus, target zones)
- server/server.lua – event handlers, database reads/writes (marking rent start/end)
- locales/en.lua – text strings for UI in English

##### README for additional insights
- Dependencies: qb-core framework (core API & database layer), qb-target (3D target zones to trigger menus), qb-menu (in-game UI)
- Installation: alter the player_vehicles table to add the rent column so server code can store a timestamp or rent status

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Libraries"
        qbcore["QBCore Framework"]:::external
        qbtarget["qb-target"]:::external
        qbmenu["qb-menu"]:::external
    end

    subgraph "Client Side"
        fxmanifestC["fxmanifest.lua"]:::custom
        configC["config.lua"]:::custom
        localesC["locales/en.lua"]:::custom
        client["client/client.lua"]:::custom
    end

    subgraph "Server Side"
        fxmanifestS["fxmanifest.lua"]:::custom
        configS["config.lua"]:::custom
        localesS["locales/en.lua"]:::custom
        server["server/server.lua"]:::custom
    end

    database["MySQL (player_vehicles table)"]:::db

    qbtarget -->|"zone triggers"| client
    qbmenu -->|"UI menus"| client
    qbcore -->|"APIs & DB layer"| server

    client -->|"net events (rent:requestVehicle, rent:returnVehicle)"| server
    server -->|"net callbacks (rent:response)"| client
    server -->|"SQL read/write (ALTER TABLE, UPDATE rent)"| database

    click fxmanifestC "https://github.com/how941201/dg-rental/blob/main/fxmanifest.lua"
    click fxmanifestS "https://github.com/how941201/dg-rental/blob/main/fxmanifest.lua"
    click configC "https://github.com/how941201/dg-rental/blob/main/config.lua"
    click configS "https://github.com/how941201/dg-rental/blob/main/config.lua"
    click localesC "https://github.com/how941201/dg-rental/blob/main/locales/en.lua"
    click localesS "https://github.com/how941201/dg-rental/blob/main/locales/en.lua"
    click client "https://github.com/how941201/dg-rental/blob/main/client/client.lua"
    click server "https://github.com/how941201/dg-rental/blob/main/server/server.lua"
    click database "https://github.com/how941201/dg-rental/blob/main/rent.sql"
    click README "https://github.com/how941201/dg-rental/blob/main/README.md"

    classDef custom fill:#aee,stroke:#036,stroke-width:2px
    classDef external fill:#afa,stroke:#063,stroke-width:2px
    classDef db fill:#fea,stroke:#f63,stroke-width:2px
```
