Skip to main content
Mythic Framework is a modular, component-based architecture for FiveM built on four pillars:

Component-Based Design

Modular components that can be registered, fetched, extended, and composed

Event-Driven Communication

Asynchronous event system with middleware for inter-resource communication

Dual-Database Architecture

MongoDB for flexible game data, MySQL for relational data and compatibility

Modern UI Stack

React + Redux/Zustand UIs with NUI bridge

Architecture Diagram

Core Layer: mythic-base

Location: resources/[mythic]/mythic-base/ The heart of the framework. Every other resource depends on mythic-base.
SystemKey FilesPurpose
Component Proxycore/sh_proxy.luaRegisterComponent, FetchComponent, ExtendComponent, RequestDependencies
Database Wrappercore/sv_database.js, core/sh_datastore.luaMongoDB + MySQL access, DataStore abstraction
Event Systemcore/sv_events.lua, core/sv_middleware.lua, core/sv_callback.luaEvents, middleware, server callbacks
Loggingcore/sv_logger.lua, core/cl_logger.luaCentralized logging with Discord webhooks
Player Managementcore/sv_player.lua, core/cl_player.luaPlayer data caching, character loading, permissions
Utilitiescore/sh_utils.lua, core/sh_core.luaCommon helpers, data validation, table operations

Resource Layer

Location: resources/[mythic]/ All feature resources depend on mythic-base and follow a consistent structure.
  • mythic-pwnzor - Anti-cheat
  • mythic-queue - Server queue
  • mythic-characters - Character system
  • mythic-loadscreen - Loading screen

Communication Patterns

Component Communication

Resources communicate via the component proxy system:
-- Resource A registers a component
exports['mythic-base']:RegisterComponent('Inventory', {
    AddItem = function(self, player, item, count)
        -- Add item logic
        return true
    end
})

-- Resource B uses the component
local Inventory = exports['mythic-base']:FetchComponent('Inventory')
local success = Inventory:AddItem(source, 'water', 5)

Callback Communication

Server-client callbacks for request/response patterns:
-- Server registers a callback
Callbacks:RegisterServerCallback('mythic-garage:GetVehicles', function(source, data, cb)
    local vehicles = GetPlayerVehicles(source)
    cb(vehicles)
end)

-- Client calls the callback
Callbacks:ServerCallback('mythic-garage:GetVehicles', {}, function(vehicles)
    print('Got vehicles:', #vehicles)
end)

NUI Communication

Client Lua and React UI communicate via NUI:
-- Lua sends to UI
SendNUIMessage({ type = 'OPEN_INVENTORY', data = inventoryData })

-- UI sends back to Lua
RegisterNUICallback('closeInventory', function(data, cb)
    SetNuiFocus(false, false)
    cb('ok')
end)

Data Flow

How all layers connect — example of opening inventory:

Load Order

Resources must load in the correct order. mythic-base must always be first.
# 1. External dependencies
ensure oxmysql

# 2. Core framework (MUST be first)
ensure mythic-base

# 3. Anti-cheat
ensure mythic-pwnzor

# 4. Core systems
ensure mythic-queue
ensure mythic-loadscreen
ensure mythic-characters

# 5. Feature resources (after core)
ensure mythic-inventory
ensure mythic-jobs
ensure mythic-finance
# ... etc

# 6. UI resources
ensure mythic-hud
ensure mythic-phone
ensure mythic-menu
Do NOT change the load order of core Mythic resources. They depend on each other and must start in a specific sequence. Changing this order will cause cascading failures across the framework.

Initialization Flow

Resources use this flow to safely initialize:
-- Wait for proxy to be ready, then register your component
AddEventHandler('Proxy:Shared:RegisterReady', function()
    exports['mythic-base']:RegisterComponent('MyComponent', { ... })
end)

-- Wait for all core components, then fetch dependencies
AddEventHandler('Core:Shared:Ready', function()
    exports['mythic-base']:RequestDependencies('MyResource', {
        'Inventory', 'Characters'
    }, function(errors)
        if #errors == 0 then
            -- Safe to use all components
            RetrieveComponents()
        end
    end)
end)

Next Steps

Component System

Deep dive into component-based architecture

Proxy Pattern

Learn the proxy system that powers Mythic

Event System

Understand event-driven communication

Database Architecture

MongoDB + MySQL dual-database system