Skip to content

Development ​

Layout ​

fxmanifest.lua                 globs only: a module adds files and never edits it
shared/lib/                    00_npenv (global NpEnv, bridge selection, bus, onBoot / onReady), 01_util (helpers,
                               validation), 02_geometry (relative layouts, jitter, polygons), 03_locale
shared/config/                 00_core.lua creates Config; <module>.lua files extend it
bridge/np_admin.lua            np_admin integration lib, vendored byte-identical (global npAdmin)
shared/np_admin_settings.lua   what staff may edit in np_admin (after every config file)
shared/locales/{en,de}/        00_core, client, integrations, server
bridge/framework/{client,server}/   1_esx 2_qbx 3_qb 9_standalone
bridge/inventory/server/       1_np (np_inventory) 2_ox 3_qb 9_none
integrations/                  one adapter per np_* sibling, loaded on both sides
server/data/catalogue.lua      the 20 starter templates and the example spawn points (inserted once)
server/core/                   init, schema + db, RPC, events, hooks, timers, factions, inventory facade, np_admin,
                               notify, sync, api
server/modules/                admin, board, citizen, director, discovery, hazards, payout, reports, scenes, spawns,
                               tasks, templates
server/boot.lua                last: schema, boot hooks, ready
client/core/                   state, NUI bridge and screens, RPC client, sync, helpers, exports
client/modules/                admin, board, closures, discovery, hazards, markers, report, scenes, work, world
sql/install.sql                schema (also applied at start)
web/                           React 18 + TypeScript strict + Vite + zustand; web/phone/ is the np_phone app
mockups/                       the HTML mockups the screens are drawn after (render.sh renders them)
tests/                         plain-Lua harness, one process per tests/test_*.lua

Load order: shared lib → config → np_admin lib → np_admin settings → locales → bridges → integrations → server data → core → modules → server/boot.lua. Core files are numbered; module files load alphabetically, so modules resolve each other's facades at call time. One global table, NpEnv (plus Config, Locales and the lib's npAdmin). Every handler returns a value or nil, 'error_code', and every code needs a localised text in en and de.

Build ​

sh
cd web
npm install
npm run build        # FiveM backdrop guard + tsc --noEmit + vite build → web/dist/index.html, web/dist/phone/index.html
npm test             # contract check (RPC names, screens, NUI actions, phone RPCs) + vitest
npm run dev          # every screen in the browser with mock data
npm run screenshots  # every screen and variant → web/screenshots/*.png (headless Chrome)

npm run build first runs the FiveM guard: a blurred surface renders as a black box over the game in FiveM, so the build fails when CSS uses backdrop-filter outside the guarded rules. The Nimbus CSS is imported unchanged from web/design/; Quicksand and Font Awesome are bundled offline. The stage is drawn for 1080p and zooms with the window height.

Browser mock ​

npm run dev runs the UI without FiveM, with mock data and a dev panel.

Parameter Values
screen scene, work, report, board, editor, director, kit (the component gallery)
variant scene: inspected, reported, hazard · work: alone, civilian, done · report: pick · board: accepted, empty · editor: walked · director: paused, quiet
locale de
shot 1 (no dev panel, no animations, for screenshots)
screens list (plain list of ids and variants, read by the screenshot script)

The np_phone app runs on its own at phone/index.html in a phone frame: ?tab=nearby|closures|board, form=1&scene=1 (the report form), empty=1&member=0, locale=de.

The screenshots on these pages come from npm run screenshots.

Tests ​

sh
tests/run.sh                 # luac -p on every Lua file, then every tests/test_*.lua suite (plain Lua 5.4 / 5.5)
tests/run.sh core            # one suite
VERBOSE=1 tests/run.sh       # with the resource's log lines

The harness loads the files the fxmanifest lists, runs threads on a fake clock, records client and local events, fakes vehicles, job changes, society accounts, np_admin nodes and np_discord roles, and fails a test on any thread error, nil SQL parameter or unserialisable payload.

Suite Covers
test_core es_extended + np_inventory + np_hud / np_discord / np_admin / np_character: db, migrations, RPC dispatcher, rate limit, staff with and without np_admin, factions, hooks, events, timers across a restart, notify, inventory facade, sync and streams, proximity
test_bridges 13 framework × inventory combinations in one process: esx / qbx / qb / standalone × np / ox / qb / none
test_integrations Declared exports and events against the sibling repositories checked out next to np_environmental
test_integrations_server, test_integrations_client Every facade with the sibling present and absent
test_flow One scene end to end through the real modules and adapters: director spawn → stream → discover → inspect → np_phone app report → voice call → board → tasks with items → clear → payout split, tip, receipts, events; plus the expiry and quiet despawn path
test_director, test_scenes, test_reports, test_tasks The server modules
test_client_core, test_client_scenes, test_client_work The client with the ESX client bridge: init, screens and focus, RPC client and timeout, fallback layer, line of sight, exports, streaming, the work flow
test_geometry Relative layouts, jitter, polygons
test_project Locales and error texts, the manifest, the SQL, the vendored np_admin lib, no ACE, the API documentation against the code (both ways), the config

Try it in game ​

As staff: /envdirector → Spawn a pick, or /envadmin → Test spawn here. Then walk up to the scene, inspect it (E), call it in (G) and open the board on a faction job (F6). See Installation → Check it works.