Skip to main content

Configuration

The floor client is a static bundle served by nginx, and it is deliberately configuration-free at runtime: there is no /config.json, no VITE_* build variable and no per-environment image. The only contract with the rest of the platform is a relative path, /api/<context>/..., resolved against the origin that served the page. "Configuration" is therefore spread over five small places, each read at a different time:

WhereRead whenControls
FLOOR_API_TARGET (vite.config.ts)when vite / vite preview startswhere the dev server proxies /api
STUB_PORT, STUB_LEASE_MS (scripts/stub-api.mjs)when the stub API startsstub port and lease length
E2E_*, STUB_URL (scripts/e2e-*.mjs)when a browser flow runswhich origin the flow drives
nginx.confby the container's nginxlisten port, /healthz, /api/ guard, cache headers, SPA fallback
constants in src/compiled inrequest timeout, replay interval, lease renewal, storage keys

Environment variables​

Build-time (VITE_*)​

There are none. The code reads no VITE_* key and no custom import.meta.env value, so the same image runs against any environment. The only import.meta.env read is the Vite built-in PROD:

KeyRead inEffect
import.meta.env.PRODsrc/pwa/register.tstrue in a vite build bundle: the service worker is registered. In vite dev it is not, because a worker would pin stale modules

Dev server and preview (vite.config.ts)​

VariableDefaultRequiredMeaning
FLOOR_API_TARGEThttp://localhost:8000noTarget of the /api proxy (changeOrigin: true) for both npm run dev and npm run preview. The default is Kong's host port in the kind cluster; the web gateway on :80 serves HTML only and has no /api route. Point it at the stub (http://localhost:8787) to work without a cluster

server.port and preview.port are fixed at 5174 with strictPort: true: if the port is taken, Vite exits instead of picking another one.

Stub API (scripts/stub-api.mjs)​

VariableDefaultRequiredMeaning
STUB_PORT8787noPort of the in-memory stand-in for fulfillment-execution, inbound-receiving and yard-management (site WH1, scripts/stub-yard.mjs)
STUB_LEASE_MS300000noLease the stub grants on task-claims and on yard moves/claims. Use 20000 to see an automatic renewal within seconds

Browser flows (scripts/e2e-station-flow.mjs, scripts/e2e-receiving-flow.mjs, scripts/e2e-yard-flow.mjs)​

VariableDefaultRequiredMeaning
E2E_BASEhttp://localhost:5174noPage origin the headless Chromium opens
STUB_URLhttp://localhost:8787noStub control origin (/__stub/* endpoints)
E2E_SHOTSe2e-shotsnoDirectory for screenshots
E2E_CHROMIUMunsetnoPath of an installed Chromium; skips npx playwright install
E2E_MODEstubnoStation flow only. real runs against a dev server proxying to Kong and never completes real work

These are test knobs, not application configuration.

Compiled-in constants​

Changing one needs a rebuild. They are listed because they decide how the app behaves when the network or the service misbehaves.

ConstantValueDefined inEffect
request timeout15 srequestTimeoutMs in src/lib/commands.tsa command that gets no answer is aborted and treated as "unreachable" (kept for replay)
replay interval5 sretryIntervalMs in src/lib/commands.tswhile the outbox is non-empty the runner retries this often; also on the browser's online event and at page load
retryable statuses429, 502, 503, 504RETRYABLE_STATUS in src/lib/commands.tskept in the outbox with the same key; every other answer is final
default lease5 minDEFAULT_LEASE_MS in src/features/station/stationState.tsused when a claim response gives no usable leaseExpiry
accepted lease range10 s to 60 minMIN_LEASE_MS, MAX_LEASE_MSa computed lease outside this range falls back to the default
renew thresholdhalf-lifeRENEW_AT_FRACTION (0.5)lease-renewals is called when no more than half the lease is left
renew retry spacing10 sRENEW_RETRY_MSa failing renewal is retried no more often than this
log line cap200 charactersMAX_LEN in src/lib/log.tslonger values are truncated with ...
open receipts pagelimit=50 per page, up to OPEN_RECEIPTS_MAX_PAGES (20)listOpenReceipts in src/api/inboundReceiving.tsfollows nextCursor until it is absent; a longer list is cut at 1000 receipts

Browser storage​

State that survives a reload lives in localStorage (via defaultStore() in src/lib/storage.ts, which falls back to memory when localStorage throws).

KeyOwnerHolds
wfc.outbox.v1src/lib/outbox.tsFIFO of commands with no definitive answer: key (the Idempotency-Key), kind, method, same-origin path, body, dedupeId, meta, createdAt, attempts. Entries whose path does not start with /api/ are dropped on load
wfc.station.v1src/features/station/stationState.tsstation, occupant id and the held task with its lease deadline (in the local clock)
wfc.yard.v1src/features/yard/yardPrefs.tssite code and hostler id of this device
wfc.yard.hostler.v1src/features/yard/hostlerState.tsthe claimed move, its trailer unit and the lease deadline (local clock)
wfc.probesrc/lib/storage.tswritten and removed once to test that localStorage works

Clearing site data deletes the outbox: commands that were not yet delivered are lost. See Troubleshooting.

Nginx (nginx.conf)​

The runtime image is nginxinc/nginx-unprivileged and listens on 8080 (EXPOSE 8080 in the Dockerfile). It serves the shell and never proxies an API; Kong must answer /api/<context> at the same origin.

LocationBehaviourCache-Control
= /healthz200 ok (text/plain), access log offnone
/api/404 application/problem+json with title "No API at this address", so a mis-routed edge is obvious and never an SPA-fallback 200no-store
= /sw.jsthe service worker, 404 if absentno-cache
= /manifest.webmanifestthe PWA manifest, 404 if absentno-cache
= /index.htmlentry documentno-cache
/assets/content-hashed bundle files, 404 if absentpublic, max-age=31536000, immutable
/try_files $uri $uri/ /index.html: React Router paths (/task, /receiving/:receiptId) load the shellnone

sw.js, index.html and the manifest are no-cache on purpose: a redeploy must not stay pinned behind an old app shell.

Image build​

docker build --build-context uikit=../warehouse-ui-kit -t warehouse-floor-client . (make image). The build takes the sibling warehouse-ui-kit checkout as a named build context. Stages: ui-kit build, app build (npm install --no-save, the macOS-generated lockfile is discarded inside the layer), nginx runtime. There is no Helm chart in this repo; see the Runbook for what that means for deployment.