Development & NUI ​
Build and checks ​
bash tests/run.sh
cd web
npm ci
npm run build
The plain Lua harness checks geometry, interpolation, ranking/time gaps, PI, Glicko-2, session staging/release and cleanup, authorization, ghosts/replays, seasons, payouts/economy guards, hooks, schema parity and vendored libraries. The NUI build checks its bundled assets. The stub harness does not emulate OneSync or all optional resource APIs. Separate isolated MariaDB checks passed for fresh SQL installation, fresh startup migration, old-schema upgrades, repeated migration and composite payout identities. MySQL 8 and live FiveM remain unverified.
Layout ​
| Path | Role |
|---|---|
shared/ |
Config, locale, math, validation and shared contracts |
bridge/ |
Framework/inventory selection and vendored libraries |
integrations/ |
Optional sibling adapters |
server/ |
Authority, tracks, sessions, RPC, settlement and persistence |
client/ |
Driving loop, gates, creator, NUI and focus |
web/ |
NUI and Racing phone app |
sql/install.sql |
Canonical schema |
docs/API.md, docs/ARCHITECTURE.md |
Public and frontend/backend contracts |
NUI contract ​
Messages use { action, data }. Screens cover race HUD/start/results/spectate/drift/drag and Nimbus lobby/creator/street/tablet/review/admin/phone views. Only one full-focus screen is active at once; race overlays do not take mouse focus. Closing/restopping releases focus and restores HUD state.
NUI calls post to https://np_racing/rpc. Responses are { ok: true, data } or { ok: false, error, message, detail? }. Localized UI should use the error code rather than depend on English text. Internal network events are private transport; use the documented server-local events or exports for integrations.
Persistence ​
Tables use the np_racing_* prefix, including tracks/versions, profiles, entries/events, results/laps/records, crews, ghosts, seasons, tournaments, flags, escrow, payout intents, season rewards and pink slips. Table presence is not proof of complete gameplay for that domain. Ghosts use server-recorded best-lap traces; replays store bounded per-driver traces. Financial delivery is not atomic with framework money calls: a crash after deposit and before SQL acknowledgement requires reconciliation. Prize/refund intents use unique (event_id,identifier,intent_kind,intent_key) identities, so multiple escrow refunds and the race prize can coexist for one driver/event. Ambiguous paying intents and migrated reconciliation rows are excluded from automatic retry. Paid legacy history is preserved; unfinished old pending/failed/paying rows require explicit legacy/legacy staff reconciliation. Held review prizes retain prize/prize/held. Startup marks stale pre-start sessions cancel-pending for login refund recovery; live/results sessions are not automatically refunded by that sweep. Cancellation physically unwinds the race before attempting its marker write/read, then records the durable marker before per-escrow refunds; successful cleanup does not prove every pending deposit has completed.
Settlement caches payout decisions and records authoritative result obligations plus each nonzero prize's unique held intent before applying profile/season effects. While the resource keeps the session in memory, per-driver/per-step progress tracks completed writes and retries failures. Rating/stat retries reapply immutable absolute profile targets, season rounds replace/deduplicate by event ID, and lap/replay writes look up existing rows before inserting. The event becomes settled/results only after required writes complete; physical race cleanup can already have completed. A paid intent can repair result/escrow metadata without another provider deposit.
After a restart, validated result rows with payment_status='pending' and a positive prize rebuild missing held prize intents on login, then use the normal flag review and payout claim flow. Prize obligations/results are durable; the settlement progress and profile targets are in memory, so complete rating/statistics recovery across a restart is not guaranteed. This uses the existing results/payout tables; no new settlement table is required. Review flag-write failures stay held. Reconnect and staff release require authoritative result approval plus no open/void flags; missing durable flag kinds cannot be treated as approval. Start rechecks phase/cancellation after awaited database, hook and vehicle-provider work.
What still needs a live server ​
Verify startup/migration against the actual database, OneSync and routing buckets, vehicle state during countdown and cleanup, gate timing at varied frame rates/ping, your inventory's usable callbacks, phone iframe RPC, optional export signatures, admin permissions, resource restarts and paid-event settlement. Screenshots in this documentation are approved browser design mockups and are labeled accordingly.
Full code review is ongoing. Pink-slip ownership, np_addon lifecycle, automatic officer dispatch, officer counts, speed-camera heat, NPC race discovery and venue rendering remain unavailable. The resource README is the current implementation checklist. The feature backlog contains later ideas; do not treat it as the public runtime API.