Code Generator
Generate QBCore resource boilerplate code and templates with best practices and proper structure built-in.
Overview
The Code Generator helps developers quickly create properly structured QBCore resources with all the necessary files, configurations, and boilerplate code. Save time and ensure consistency across your resources with predefined templates and customizable options.
QBCore Code Generator
Generate professional QBCore resources with proper structure, best practices, and all necessary files included.
Job Resource
Starter job resource with QBCore events, config, and locale stubs
Shop System
Basic shop scaffold with NUI placeholder and purchase handler stub
Housing Script
Minimal housing scaffold with callbacks and config placeholders
Heist Framework
Lightweight multi-stage heist skeleton for custom logic
Phone App
Simple qb-phone app skeleton with UI assets and callback
Utility Script
General utility scaffold with shared helper examples
Configuration
Use lowercase letters, numbers, and hyphens only
Features
Additional Options
Template Capabilities
Job Resource Template
- QBCore Event Hooks: Client events for
OnPlayerLoaded
andOnJobUpdate
with helper bootstrap function. - Config & Locale Scaffolds: Feature toggles persisted to
config.lua
plus starter locale entries inlocales/en.lua
. - Shared Metadata:
shared.lua
includes grade placeholders and feature comments for quick reference. - Optional Extras: Toggle SQL, docs, and test boilerplate from the generator panel.
Shop System Template
- NUI Placeholder: Basic HTML/CSS/JS bundle wired to the generated resource namespace.
- Server Purchase Stub: Handler outlines where to validate inventory and payments.
- Configured Inventory: Default shop items stored in
config.lua
for easy expansion. - Optional SQL/Docs/Tests: Generate scaffolding to wire shops into a database or documentation workflow.
Housing Script Template
- Callback Skeletons: Server callback for fetching houses and client event for entering a property.
- Configuration File:
config.lua
seeded with debug flag and empty housing table. - Shared Flags:
shared.lua
exposes multicharacter support state for downstream logic. - Optional SQL/Docs/Tests: Create placeholder migrations, event docs, and basic test files as needed.
Heist Framework Template
- Stage Hooks: Client and server events ready for custom stage logic and reward handling.
- Configurable Stages:
config.lua
populated with sample stage timings to extend. - Feature Awareness: Shared config tracks phone/management requirements for conditional behaviour.
Phone App Template
- qb-phone Integration: Registers basic event listener and callback for fetching app data.
- UI Bundle: Ships HTML/CSS/JS assets with fetch example for in-game requests.
- Config Toggles:
config.lua
exposes whether the feature requires the phone system.
Utility Script Template
- Shared Helpers: Demonstrates exporting notify/log helpers across client and server.
- Command Example: Client script registers a sample command bound to the utilities module.
- Server Logging Stub: Placeholder server event that illustrates structured logging.
Generator Options
All templates share common toggles for SQL migrations, documentation stubs, and minimal Lua test files. Enable them per resource to match your workflow.
Best Practices Included
Code Structure
-- Example client.lua structure
local QBCore = exports['qb-core']:GetCoreObject()
local PlayerData = {}
-- Events
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
PlayerData = QBCore.Functions.GetPlayerData()
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo)
PlayerData.job = JobInfo
end)
-- Functions
local function DoSomething()
-- Your code here
end
-- Exports
exports('DoSomething', DoSomething)
-- Commands
RegisterCommand('example', function()
DoSomething()
end, false)