Skip to content

Development ​

Layout ​

fxmanifest.lua              globs only: a module adds files, never edits the manifest
shared/lib/                 NpPrison namespace, locale, integration registry, facility / security / item registries
shared/config.lua           core configuration
shared/config/              facilities, integrations, then one file per module
shared/locales/{en,de}/     one file per module (Lua strings; the NUI gets them from the client)
shared/np_admin_settings.lua  settings and permission nodes for np_admin
bridge/np_admin.lua         np_admin integration lib, vendored byte-identical
bridge/framework/{client,server}/  0_common 1_qbx 2_qb 3_esx 9_standalone
bridge/inventory/server/    0_common 1_ox 2_qb 3_esx 9_none (np_inventory is integrations/server/np_inventory.lua)
integrations/{server,client}/  one file per optional sibling, each with a fallback (not np_npchandler / np_prophandler)
server/core/                init, database, RPC, inventory, hooks, events, players, timers, module API, records,
                            inmates, sentence ticker, behaviour, account, cells, property bag, alert, jail, exports,
                            commands, solitary
server/modules/<module>/    booking, intake, release, parole, alternatives, routine, sight, jobs, activities, hud,
                            commissary, plug, collect, contraband, escape, visits, mail, phone, console, npcguards
client/core/, client/modules/<module>/
sql/                        install.sql (core) + one file per module, items.sql (ESX)
install/                    item definitions for ox_inventory and qb-inventory
web/                        NUI: React 18 + Vite 5 + TypeScript strict + Zustand
                            index.html = every screen and HUD piece, phone.html = the np_phone Corrections app
web/design/                 Nimbus UI, copied unchanged
tests/                      plain-Lua harness, one process per tests/test_*.lua

Everything is server-authoritative: sentence, served time, behaviour, the account, cells, the property bag and the alert level live on the server. The client draws and asks through RPCs; every RPC has a schema, a rate limit, a permission and position check. Sentence, behaviour, account and alert change only through their stores, which record the change, run the hooks, fire the events and push the update to the client.

Every feature is a module with its own config file, locale files, server and client files, NUI screen folder, SQL file and test suite. Modules never edit each other's files or core; they talk through core's stores, hooks and small Lua seams that are resolved when called, so any module can be switched off.

Build ​

sh
cd web
npm ci
npm run build        # strings from the Lua locales + FiveM guard + tsc --noEmit + vite build
npm test             # strings + contract check (Lua ↔ NUI: RPCs, screens, mocks, error codes) + vitest
npm run dev          # browser mock on http://localhost:5187
npm run screenshots  # every screen and shot to web/screenshots/ (headless Chrome)

npm run build runs a FiveM guard first: FiveM's CEF cannot render backdrop-filter, so the build fails when CSS uses it without the FiveM fallback. The contract check compares the RPC names, NUI actions and screens of the Lua side and the NUI, and fails when a typed RPC has no Lua handler or no mock.

Browser mock ​

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

Parameter Values
screen A screen or shot id: booking, chargesheet, chargesheet-alt, intake, hud, hud-tutorial, hud-lockdown, jobs, jobs-shift, commissary, plug, hide, hide-yard, bribe, bribe-review, escape, escape-fence, escape-siren, escape-manhunt, parole, parole-inmate, mail, console, console-mail, corrections, wallphone, burner, alternatives-service, core-skill, …
locale de
bg none or yard (the scene behind the UI)
clean 1 (no dev chrome)

web/scripts/screenshots.sh [filter] builds, serves web/dist and renders every screen and shot to web/screenshots/<id>.png at 1920×1080. LOCALE=de writes <id>.de.png, BG=yard puts the yard behind the UI, SCALE=3 renders at three times the size for a close look at edges. The screenshots on these pages come from it.

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 jail        # only suites whose name contains "jail"
VERBOSE=1 bash tests/run.sh   # with the resource's log lines

The harness loads the resource in manifest order with stubbed natives, a controllable clock, an in-memory oxmysql that runs the real SQL, and fakes of es_extended, qb-core, qbx_core, np_inventory (with confiscation), ox_inventory, qb-inventory, np_hud, np_discord and the other siblings with their real signatures.

Suites Cover
test_core, test_sentence, test_jail Boot, schema and migrations, registries, locales, permissions, the RPC layer, hooks, behaviour, account, alert; online-only ticking, relog, restart, release at zero, held releases; the property bag round trip, seizure, cash and cap, state bags, events, compatibility events, commands, cells
test_boot_esx, test_boot_qb, test_boot_qbx, test_boot_standalone One round trip per framework and inventory
test_flow es_extended + np_inventory with every module: sentencing screen → intake → work shift → commissary → contraband → solitary → parole release, and a fence breakout → caught
test_<module> One suite per module (booking, intake, release, parole, alternatives, routine, sight, jobs, activities, hud, commissary, plug, collect, contraband, escape, visits, mail, phone, console)
test_client, test_client_*, test_*_client Client core, NUI bridge and focus, target providers, booking, contraband, HUD and phone flows
test_integrations* The declared exports against the sibling repositories next to np_prison, each sibling stopped mid-suite, the np_admin lib byte-identical
test_seams The manifest, net events, the documented exports against the code, no ACE anywhere, the module layout

What the suites cannot see: GTA natives (teleports, animations, collision, doors), real np_hud and target rendering, and oxmysql itself. See Installation → Before you open it.

Adding a module ​

A module is a set of new files: shared/config/<m>.lua, shared/locales/{en,de}/<m>.lua, server/modules/<m>/, client/modules/<m>/, optionally web/src/screens/<m>/ (discovered by the NUI), sql/<m>.sql and tests/test_<m>.lua. The server side calls NpPrison.Module.define({ name, onReady, onJailed, onReleased, onTick, … }), registers RPCs named <m>.<name> with a schema, and changes the sentence, behaviour, account and alert only through core's stores. New exports must be documented: the seams suite fails on an undocumented one.