High-Level Overview
At its core, Mythic Framework is built on four architectural 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 for all user interfaces 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.
Responsibilities
Component Proxy System
Component Proxy System
File:
core/sh_proxy.luaProvides the component registration and dependency injection system:RegisterComponent()- Register new componentsFetchComponent()- Retrieve componentsExtendComponent()- Extend existing componentsRequestDependencies()- Async dependency loading
Database Wrapper
Database Wrapper
Files:
core/sv_database.js, core/sh_datastore.lua- MongoDB connection management (Node.js)
- MySQL integration via oxmysql
- Query abstraction layer
- Connection pooling
- Error handling
Event System
Event System
Files:
core/sv_events.lua, core/cl_events.lua, core/sv_middleware.lua- Event registration and handling
- Middleware support (pre/post processing)
- Network event routing
- Event prioritization
- Callback management
Logging & Error Handling
Logging & Error Handling
Files:
core/sv_logger.lua, core/cl_logger.lua- Centralized logging
- Discord webhook integration
- Error tracking
- Debug information
- Log levels (trace, info, warn, error)
Player Management
Player Management
Files:
core/sv_player.lua, core/cl_player.lua- Player data caching
- Character loading
- Permission management
- Player state synchronization
Utilities
Utilities
Files:
core/sh_utils.lua, core/sh_core.lua- Common utility functions
- Data validation
- String manipulation
- Table operations
- Math helpers
mythic-base File Structure
Resource Layer
Location:resources/[mythic]/
All feature resources depend on mythic-base and follow a consistent structure.
Resource Categories
- Core Systems
- Gameplay
- UI
- Utilities
Essential framework resources:
mythic-pwnzor- Anti-cheatmythic-queue- Server queuemythic-characters- Character systemmythic-loadscreen- Loading screen
Standard Resource Structure
Every Mythic resource follows this pattern:Communication Patterns
1. Component Communication
Resources communicate via the component proxy system:2. Event Communication
Resources trigger and listen to events:3. Callback Communication
Server-client callbacks for request/response patterns:4. NUI Communication
Client Lua ↔ React UI:Data Flow Example: Opening Inventory
Let’s trace what happens when a player opens their inventory:
This demonstrates how all layers work together: keybinds → client events → server processing → database → client update → NUI rendering.
Load Order & Dependencies
Resources must load in the correct order:Architectural Benefits
Modularity
Each resource is independent. Add, remove, or replace resources without affecting others.
Scalability
Component system allows easy scaling. Add new features by creating new components.
Maintainability
Clear separation of concerns. Each resource has a specific purpose and structure.
Extensibility
ExtendComponent allows adding functionality without modifying core code.
Testability
Components can be tested independently. Mock dependencies easily.
Performance
Lazy loading, dependency injection, and efficient event handling optimize performance.
Design Principles
The architecture follows these principles:- Separation of Concerns - Each resource has a single, well-defined purpose
- Don’t Repeat Yourself (DRY) - Common functionality in mythic-base, reused everywhere
- Single Source of Truth - Database is the source of truth, components cache appropriately
- Fail Fast - Errors are caught early, logged, and handled gracefully
- Convention over Configuration - Standard structure reduces configuration needs
- Progressive Enhancement - Core features work without optional resources