d0536da3d7
Add apps/desktop, a thin Tauri v2 shell wrapping the SAME @parking/web SPA so the desktop and browser UIs never drift: dev loads the Vite dev server (HMR), prod bundles the web app's dist/. No business logic in the shell (device/auth/ ledger stay in @parking/server); deny-by-default capabilities. apps/web (single UI source of truth): - lib/origin.ts: centralize the backend origin (API_BASE/apiUrl/wsUrl from VITE_API_BASE); no-op in the browser, lets the desktop build target Fastify. - lib/kiosk.ts: block the right-click context menu in PROD only (dev keeps it + devtools). - lib/desktop-updater.ts: prompt-on-update auto-update (no-op in browser/offline) → downloadAndInstall + relaunch; i18n update.* keys (sq+en). - .env.production: VITE_API_BASE wired to the Fastify origin for the bundle. Desktop: - window starts maximized (not fullscreen — operator keeps OS access). - auto-update via tauri-plugin-updater + -process; self-hosted endpoint is a PLACEHOLDER to fill in. Updater keypair: pubkey embedded in tauri.conf.json; private key + password kept OUTSIDE the repo (~/.parking-updater-keys) and as TAURI_SIGNING_* build secrets. - Turbo build is a no-op; the real signed bundle is `pnpm --filter @parking/desktop bundle` (verified → .deb/.rpm/.AppImage + .sig signatures). Verified: cargo check clean; turbo run build lint 14/14 green; i18n parity holds; no key/sig/bundle artifacts in the repo. Wiki (security + desktop analysis recorded alongside): - new concepts/tpm.md (TPM 2.0: how it works, sealed-LUKS auto-unlock + non- extractable signing key, limits — live-root, bus-sniff — TPM-vs-ATECC608 by platform). - new decisions/desktop-shell-tauri.md (Tauri v2 over Electron; best-case Ubuntu 26.04 LTS, worst-case Windows+WSL → kiosk browser; full as-built). - pull-the-disk attack trace on append-only-event-chain; ATECC608 not-in-a-PC caveat; cross-links from disk-os-hardening / threat-model. - open-questions #11 (appliance WebKitGTK), #12 (TPM hardening impl), #13 (startup verifyChain self-check); index/overview/log/standing-decisions. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
2.9 KiB
2.9 KiB
type, tags, sources, updated
| type | tags | sources | updated | ||||
|---|---|---|---|---|---|---|---|
| overview |
|
|
2026-06-21 |
Parking System — Overview
The synthesis / entry point for this wiki. Start here, then follow links. Catalog of every page: index. Source summaries: parking-system-architecture.
What it is
A parking-management web application running on a dedicated, hardened Linux appliance deployed on-site at a parking facility. Two forces shape nearly every decision:
- offline-first — a park may be air-gapped; nothing core may depend on a network.
- threat-model — the primary adversary is the legitimate operator at the booth, not an outsider. The classic fraud is take the cash, delete the record.
The architecture in one pass
- Stack (technology-stack / standing-decisions): turborepo · fastify · react-vite-spa · sqlite + drizzle-orm · local-jwt-auth — all open-licensed to avoid lock-in (cf. rejected payload-cms, refine, logto-zitadel-oidc). The operator UI ships as a thin desktop-shell-tauri kiosk shell (chosen over Electron).
- Integrity is the heart of it: an append-only-event-chain (hash-chained, atecc608- signed) plus external reconciliation — that's what remote sync really is. Encryption at rest (disk-os-hardening) defends a secondary threat.
- Devices sit behind a device-adapter-pattern (swap hardware → new adapter only), with the barrier-not-a-door safety principle keeping physical safety in barrier-operator firmware.
- Access control today is the dingtian-relay relay+input controller behind network-isolation — chosen because its inputs are decoupled from its relays, enabling host-in-the-loop ticket-first entry (resolving access-controller-button-flow). The uhppote-controller and zkteco-controller were evaluated and rejected (historical). The deeper fork is still the trust-boundary (uhppote-vs-esp32); the esp32-custom-controller remains the prevention-grade alternative.
- Readers split two ways (entry-exit-readers): permit holders via wiegand (autonomous), casual/transient via host-side lpr-camera / QR; both can share a relay.
- A reference bom lists recommended devices.
Where it stands
6 open-questions still drive procurement — most critically lane topology, failure modes (fail-open on exit), the reconciliation channel, and backup/durability.
Reading paths
- Security-first: threat-model → append-only-event-chain → reconciliation → uhppote-vs-esp32.
- Hardware-first: bom → dingtian-relay → access-controller-button-flow → entry-exit-readers.
- Stack-first: technology-stack → offline-first → device-adapter-pattern.