Dev workflow
NUI in the browser
sh
cd web
npm ci
npm run dev # http://localhost:5173: the phone with mock data for every app
npm run typecheck && npm run build # must pass before committing (output: web/dist)Outside FiveM, every app's mock.ts acts as the backend, so you can build and screenshot the whole phone without a server.
URL parameters
| Parameter | Effect |
|---|---|
?app=<id> | Open an app (messages, wallet, chirp, …) |
?app=<id>¶ms=<json> | Open with deep-link params, e.g. ?app=messages¶ms={"text":"hi"} |
?stage=game | In-game stage: phone bottom-right with slide / ring / full-screen behaviour |
?stage=game&closed=1&incoming=1 | Ring mode: incoming call while the phone is put away (Y / Backspace) |
?locked=1, ?passcode=1234 | Lock screen, passcode |
?cc=1 | Control Center |
?page=2, ?edit=1 | Widget page, edit mode |
?banner=1, ?call=1 | Notification banner, active call |
?streamer=1 | Streamer mode |
?placeholders=1 | Inert icons for reserved apps that don't exist yet |
?time=09:41 | Fixed clock for screenshots |
App-specific parameters (?app=phone&incoming=1, ?app=photos&viewer=1, ?app=chirp&view=compose, …) are listed at the bottom of each app area page.
In the browser console (dev only): window.npDev = { nui, push, store, openApp }.
Lua
- Lua 5.4, 2-space indent, no CfxLua-only syntax (no backtick hashes; use
joaat). - Every file must pass
luac -p. - Every server handler validates
paramstypes and ownership. Never trust amounts or ids from the client. - No polling while the phone is closed. The idle resmon target is 0.00 ms.
Screenshots
- Take shots of the dev build at a 600×900 viewport into
web/screenshots/. python3 mockups/real/build.pyrenders the sheets todocs/screenshots/.- In this docs repo:
npm run sync:images.
Design mockups
The original concept sheets are plain HTML/CSS (mockups/*.html, mockups/phone.css, renders in mockups/renders). Re-render them with ./mockups/render.sh. Icons are Font Awesome Free.
Next
- Writing an app: manifest, screens, services, mocks
- Architecture: every contract between Lua, NUI and apps