Development ​
Layout ​
fxmanifest.lua
shared/lib/ 00_core (NpShops namespace, bridge selection, validators), 01_locale,
02_integrations (adapter registry), 03_registry (brands, shop types)
shared/config.lua Config: framework / inventory / dispatch choice, integrations, admins, keys, rate limit
shared/config/<module>.lua one file per module (Config.<Module>)
shared/config/shops/*.lua the shops, one file per brand group
shared/locales/{en,de}/ core + one file per module
shared/brands.lua generated brand registry (never edit by hand)
shared/np_admin_settings.lua np_admin "Resource settings" page
bridge/np_admin.lua np_admin lib, byte-identical vendor copy
bridge/framework/ {client,server}/ 0_common 1_esx 2_qbx 3_qb 9_standalone
bridge/inventory/server/ 0_common 1_ox 2_qb 3_esx 9_none
bridge/dispatch/server/ 0_common 1_ps 2_cd 3_qs 9_builtin
bridge/fuel/ server/0_common, client/ 0_common 1_ox 2_legacy 3_cdn 8_statebag 9_none
integrations/ one adapter per np_* sibling (server and client)
server/core/ 00_init 01_db 02_rpc 03_inv 04_hooks 05_events 06_players 07_timers 08_api
09_admin 10_shops 11_extend
server/modules/ admin catalog checkout clerks food fuel luxury ownership pawn phone robbery services weapons
client/core/ 00_state 01_nui 02_rpc 03_sync 04_world
client/modules/ the client side of the modules
sql/install.sql every table (the same statements as the migrations)
assets/logos/{svg,raw}/ brand logos, served to the NUI
tools/logos/ logo pipeline
web/ NUI: React 18 + Vite 5 + TypeScript strict + zustand
index.html = game screens, phone.html = np_phone app
tests/ plain-Lua harness, fakes, smoke test, suites, run.sh
Load order: shared libs → config → module configs → shops → np_admin lib → settings → locales → brands → init. Server: oxmysql → framework bridge → integrations → inventory, dispatch and fuel bridges → core → modules → ready. Files inside a folder load in name order.
Modules plug into each other only through core extension points, never at file load: item line kinds (weapon,
ammo, food, combo, luxury), item locks, pricing steps, shop states, storefront views, payment methods, revenue
listeners and the stock provider. A module can be off, and the others keep working.
Build ​
cd web
npm ci
npm run build # strings from the Lua locales, FiveM guard, tsc --noEmit, vite build → web/dist
npm test # strings, strict contract check, vitest
npm run dev # browser mock
npm run build first generates the UI strings from shared/locales (the Lua files are the single source), then runs
scripts/check-fivem-guard.mjs. In FiveM a blurred surface renders as a black box over the game, so the CSS turns
backdrop-filter off under html.nb-fivem and uses a denser glass tint instead. The guard fails the build when that
rule or the code that sets the class is missing.
npm test runs scripts/check-contract.mjs --strict: every RPC method, NUI action, screen and error code must match
between the Lua code, the web types and the locales.
Browser mock ​
npm run dev serves the UI without FiveM, with mock data. URL parameters:
| Parameter | Values |
|---|---|
screen |
shop, pump, owner, kitchen, admin, … (?list=1 lists every screen and shot) |
shot |
A named shot of a mock, e.g. shop-ammunation, robbery-safe |
locale |
de |
liquid |
1 (Liquid Glass) |
accent |
1 (Config.BrandAccent) |
bg |
none or a backdrop name |
clean |
1 (no dev bar) |
The phone app: phone.html?shot=phone-discover, ?tab=.
Screenshots ​
cd web
npm run screenshots # web/screenshots/<shot>.png at 1920×1080, phone-* at 500×960
LOCALE=de npm run screenshots # <shot>.de.png
MATERIAL=liquid npm run screenshots # <shot>.liquid.png
The script builds the UI, serves it with vite preview and renders every screen the app lists with headless Chrome.
The screenshots on these pages come from it.
Tests ​
tests/run.sh # luac -p on every Lua file, then every tests/test_*.lua in its own Lua process
tests/run.sh core # only suites whose name contains "core"
VERBOSE=1 tests/run.sh # with the resource's log lines
Plain Lua 5.4, no server needed. The harness fakes the FiveM natives, oxmysql (an in-memory SQL subset), the
frameworks, the inventories and the np_* siblings. The sibling fakes validate like the real resources: np_inventory
refuses stash ids over 64 characters, the np_npchandler fake refuses unknown definition fields, ids over 64 characters, used ids and clerks whose policies or
interaction handlers are not registered, np_mdt's
ReportCall checks its call model (refused calls land in H.fakes.mdtRefused), and np_payments refunds credit the
payer (H.fakes.payments.refundFails = true makes them fail; H.fakes.payments.answer scripts the dialog and may
Wait). H.sql.delay(pattern, ms, 'after' | 'before') simulates a slow database for race tests.
| Suite | Covers |
|---|---|
core |
ESX + np_inventory boot, schema against sql/install.sql, the RPC layer (with a fuzz pass over every method), hooks, events, sync, timers, tokens, locales, admins, a scan that fails on any ACE call, the np_admin vendor copy |
seams |
Manifest globs, net events, the export list both ways, module file ownership |
integrations |
Every declared sibling export against the sibling repos next to this one |
boot_np, boot_esx, boot_qbx, boot_qb, boot_standalone |
ESX + np_inventory with every sibling, ESX inventory, qbx + ox_inventory, qb + qb-inventory, standalone |
payloads |
Drives the real server code and writes every NUI payload to web/tests/fixtures/*.json. npm test type-checks them against the web types |
| one per module | catalog, checkout, weapons, food, fuel, luxury, pawn, services, robbery, clerks, ownership, admin, phone, plus client and client_fuel |
A suite:
local H = dofile((arg[0]:match('^(.*)/[^/]+$') or 'tests') .. '/harness.lua')
H.boot({ framework = 'esx', inventory = 'np', resources = { np_hud = true, np_payments = true } })
H.addPlayer({ id = 1, identifier = 'char1:a', coords = vector3(25.7, -1347.3, 29.5), money = { cash = 500 } })
H.test('buys an eCola', function()
local q = H.rpcOk(1, 'checkout.quote', { shopId = '247_innocence', lines = { { name = 'ecola', count = 2 } } })
H.eq(q.total, 6)
end)
H.finish()
Logos ​
The brand registry and the logos are built by tools/logos/. The scripts need Pillow and vtracer
(pip install pillow vtracer).
| Step | Command | Output |
|---|---|---|
| Source list | edit tools/logos/brands.src.json |
brand → gta.wiki file name, group, type |
| Download | python tools/logos/fetch.py |
assets/logos/raw/<id>.png |
| Vectorize | python tools/logos/vectorize.py [ids…], then npx svgo -r -f assets/logos/svg --multipass |
assets/logos/svg/<id>.svg |
| Registry | python tools/logos/build_registry.py |
assets/brands.json, shared/brands.lua |
- Most logos are traced to SVG. The Paint Shop and Legendary Motorsport stay PNG, because tracing loses too much detail.
- Five brands have no logo on the wiki (Sub Urban, Vespucci Movie Masks, Bob Mulét, Beeker's Garage, Warstock). They
use hand-drawn wordmarks from
tools/logos/drawn/. - Brand colors come from the dominant logo hue. Where the store signage differs, a manual override in
build_registry.pywins.