Skip to content

Development ​

Layout ​

fxmanifest.lua              globs only: a module adds files, never edits the manifest
shared/lib/                 00_npfuel (NpFuel namespace, bridge selection, bus) 01_util 02_locale 03_fuel 04_brands
shared/config/              00_core 01_fuel 02_stations 03_supply, then one file per module
shared/np_admin_settings.lua  the settings np_admin may edit
shared/locales/{en,de}/     one file per module (Lua strings)
bridge/np_admin.lua         np_admin integration lib, vendored byte-identical
bridge/framework/{client,server}/  0_common 1_esx 2_qbx 3_qb 9_standalone
bridge/inventory/server/    0_common 1_np 2_ox 3_qb 9_none
integrations/               one file per sibling (np_hud, np_inventory, np_payments, np_phone, np_menu,
                            np_identification, np_character, np_discord, np_shops, np_minigames), both sides
server/core/                init (staff), schema + data layer, RPC + tokens, events, timers, ledger, notify, sync,
                            stations store, vehicle fuel state, api
server/modules/             vehicles, pump/, jerrycan, ev, stations/, supply/, phone, admin/
server/boot.lua             last: schema, stores, ready
client/core/                state, NUI bridge + screens, RPC client, sync, helpers, api
client/modules/             the client half of every module
sql/install.sql             schema (also applied at start)
web/                        NUI: React 18 + Vite 5 + TypeScript strict + Zustand
                            index.html = every screen, phone.html = the np_phone app
web/design-system/          Nimbus UI, copied unchanged
mockups/, docs/renders/     the concept mockups the screens follow
tests/                      plain-Lua harness, one process per tests/test_*.lua

Every feature is a module with its own config file, locale files, server and client files, NUI screen folder and test suite. Modules talk to each other through the core stores and an in-process bus, never by editing each other's files. Only NpFuel.VehicleFuel.set writes vehicle fuel, only NpFuel.Stations changes stock and prices, and every money movement goes through NpFuel.Pay or a station's balance and lands in the ledger.

Build ​

sh
cd web
npm ci
npm run build        # FiveM guard + tsc --noEmit + vite build → web/dist/index.html, web/dist/phone.html
npm test             # contract check (Lua ↔ NUI: RPCs, screens, mocks) + vitest (silver line, format, i18n)
npm run dev          # browser mock on http://localhost:5187
npm run screenshots  # every screen and variant, English and German, to web/screenshots/

npm run build first runs scripts/check-fivem-guard.mjs: FiveM's CEF cannot render backdrop-filter, so the build fails when CSS uses it without the html.nb-fivem fallback. npm test starts with scripts/check-contract.mjs, which compares the RPC names, screens and NUI actions of the Lua side and the NUI, and fails when a typed RPC has no mock or a screen has no mock entry.

Browser mock ​

npm run dev runs the UI without FiveM, with mock data. URL parameters pick a screen:

Parameter Values
screen pump, pump.meter, ev.charge, vehicles.gauge, stations.owner, stations.buy, supply.orders, supply.tanker, admin.network, admin.editor, _kit
variant A mock variant, e.g. wrongfuel, declined, airfield (pump), live (EV), prices (owner panel), unload (tanker)
screens list: every screen and variant
locale de
shot 1 (no dev chrome, for screenshots)

Example: http://localhost:5187/?screen=pump&variant=wrongfuel&locale=de. The phone app runs at /phone.html (?tab=find|favourites|spending|alarms, ?station=<id>, ?owner=1). The screenshots on these pages come from npm run screenshots: <id>[@<variant>].png in English, ….de.png in German, phone@<tab>.png in a phone frame.

Tests ​

sh
bash tests/run.sh             # luac -p on every Lua file, then every suite (plain Lua 5.4, no game needed)
bash tests/run.sh flow        # one suite (the end-to-end loop)
VERBOSE=1 bash tests/run.sh   # with the resource's log lines

The harness loads the files the manifest lists, runs threads on a fake clock, keeps a fake oxmysql, state bags and client events, and fakes every framework, inventory and sibling. A test fails on any thread error, a nil SQL parameter or an unserialisable payload.

Suites Cover
test_core, test_qbx, test_qb, test_standalone Boot, seed, stations store, sync, RPC dispatcher, staff, tokens, timers across a restart, payments, vehicle state bags, exports, ledger, on es_extended + np_inventory, qbx_core + ox_inventory, qb-core + qb-inventory and standalone
test_vehicles, test_pump, test_jerrycan, test_ev, test_stations, test_supply, test_phone, test_admin One suite per module
test_client, test_pump_client, test_vehicles_client Client core, NUI bridge and focus, the pump, EV, vehicle and jerry can flows
test_flow, test_flow_qbx, test_flow_standalone The whole loop end to end: low fuel → refuel → auto order → a driver's run → a player-owned station with an escrowed order, sales and a withdrawal → jerry can → EV
test_integrations The declared exports and events against the sibling repositories next to np_fuel, the np_admin lib byte-identical
test_project Locales, manifest, SQL, the API reference against the code (both ways), config data

Try it in game ​

  1. /setfuel 10 (staff) in a vehicle, drive until the low-fuel hint shows, press G.
  2. E at a pump, fill up, try the wrong fuel.
  3. /fueladmin for the network, /fueladmin editor to place a fill point and a depot.
  4. F7 for the order board, take an order at a depot, rent a rig, load, unload.
  5. Buy a station at its office, then /station.

See Installation → Before you open it for the full checklist.