
// 06 // TECHNICAL BLUEPRINT //
Core Architecture
The infrastructure under the StreetWizard platform, layer by layer — each carrying its build state.
LAYER 01
ARCHITECTURE: FLAT-COST REALTIME SCALING
[01]The core engineering challenge of multiplayer GPS is that naive coordinate broadcasting costs grow with the square of the crowd: every rider talks to every other rider. StreetWizard attacks that cost at the source — by sending less, not by routing differently.
[02]Riders share one realtime channel. Heavy identity — avatar, plate, build — travels once through presence; the position stream carries only what changes. The emission rate then adapts to crowd size: a convoy of twelve emits roughly twice a second for tight formation, while a swarm past two hundred backs off to once every four seconds, where nobody can perceive the difference anyway.
[03]Each client then covers the gaps itself: knowing a peer's last position, heading and speed, it predicts the motion between samples, so the map reads smoother than the network actually is. Rendering is capped the same way — only the nearest sixty vehicles get a marker, because a thousand pins is a dead phone, not a feature. Bandwidth per rider falls as the crowd grows.
LAYER 02
GLOBAL TELEMETRY & SERVER-SIDE AGGREGATION
[01]Tracking the exact distance traveled by the entire global community simultaneously requires a flawless approach to distributed state management to avoid database race conditions.
[02]The client measures its own distance from the GPS trail, filtering out the jitter a parked phone produces, and banks the running total against its rider row. Nothing is summed on the device.
[03]The community figure is then a single privileged server-side aggregate over every rider row. One source of truth, one query — and because the client never submits the total, no client can inflate it.
// BUILD STATE
What Runs, What Is Partial, What Is Only Designed
Every block below carries its state. A dossier written entirely in the present tense asks a reader to believe all of it or none of it — and the first engineer who greps for a named subsystem and finds nothing chooses none. Labelling the blocks is what makes the LIVE ones worth reading.
- LIVERunning in production. The named mechanism is in the source or the database.
- PARTIALExists, but not as the paragraph describes it. The gap is stated in the block.
- DESIGNEDA solid plan. Not built. Nothing in the codebase implements it yet.
Realtime Fleet Layer & Bandwidth Discipline
LIVENaive coordinate broadcasting costs the square of the crowd — everyone talks to everyone. StreetWizard attacks that cost by sending less, not by routing differently.
- [+] PRESENCE / STREAM SPLITRiders share one realtime channel. Heavy identity — avatar, plate, build — is published once through presence. The position stream carries only what changes, so a 5 kB avatar never rides the hot path.
- [+] ADAPTIVE EMISSIONThe send rate follows fleet size: a convoy of twelve emits about twice a second for tight formation; past two hundred it backs off to once every four seconds, where the difference is imperceptible anyway.
- [+] CLIENT-SIDE PREDICTIONEach client fills the gaps itself, extrapolating a peer's motion from its last position, heading and speed. The map reads smoother than the network actually is, and rendering is capped at the sixty nearest vehicles — a thousand pins is a dead phone, not a feature.
Global Odometer — One Source Of Truth
LIVEHardened since this page was first written: km and level are no longer client-writable at all, and every write passes a server-side velocity clamp.
A community distance counter is only worth showing if it cannot be gamed. The design question is not how to aggregate fast, but who is allowed to assert a number.
- [+] MEASURED ON DEVICEThe client derives its own distance from the GPS trail, filtering the jitter a parked phone produces so a car standing still never accumulates kilometres.
- [+] BANKED PER RIDEREach rider owns one row and only ever advances their own. There is no shared counter to contend over, so there is no race to resolve.
- [+] AGGREGATED SERVER-SIDEThe community figure is a single privileged aggregate over those rows. Because no client ever submits the total, no client can inflate it — the number on screen is the sum of what was actually driven.
"Live Radio" Audio Synchronization Engine
LIVEStreaming the exact same track to a convoy requires mitigating network latency variance between peers.
- [+] SERVER-HELD START TIMEThe station keeps the current track and the instant it started on the server, not on any one device. There is no host to elect and nothing to renegotiate when someone drops.
- [+] SEEK ON JOINA client works out how long the track has been playing and seeks straight to that offset. Everyone converges on the same position in the same song — close enough that a convoy hears one track, without pretending network jitter does not exist.
Kinematic 3D Rendering (Mapbox GL JS)
LIVEThe frontend relies on a heavily customized WebGL rendering pipeline.
- [+] CAMERA INTERPOLATIONA single requestAnimationFrame loop drives position, bearing and zoom with dt-aware exponential smoothing. Cockpit pitch sits at 66° and zoom eases from 18.2 at rest toward 16.8 at speed, so the view opens up as the car goes faster.
- [+] SPATIAL UI LAYERSAvatars, reports and pins are HTML markers positioned over the canvas, not WebGL layers — deliberately. It keeps them stylable, accessible and tappable, and the marker count is capped so the DOM never becomes the bottleneck.
Automated Telemetry & State Hydration
LIVEA debugging mechanism built into the client, so a field crash arrives with enough context to reproduce it.
- [+] STATE SNAPSHOTA caught error boundary serializes what is needed to reproduce the failure: the failing view, the active route state and the current peer list.
- [+] RECENT GPS TRAILThe snapshot ships with the last stretch of raw GPS, because a navigation bug is rarely reproducible without the path that triggered it.
- [+] ROUTED TO THE DESKReports are routable to lead@seub.net, so a production crash reaches engineering while the drive it came from is still fresh.
Edge CDN Audio Scaling & 24/7 Rotation
LIVEBroadcasting live audio to thousands of concurrent pilots would normally generate catastrophic egress costs. StreetWizard offloads it entirely.
- [+] STATE-ONLY BROADCASTRealtime channels never carry audio. They broadcast the playback state payload only — the exact started_at timestamp.
- [+] CLIENT-SIDE SYNCEach device computes (now - started_at) and pulls the static chunk from the Edge CDN with an aggressive cacheControl of 31536000, pushing bandwidth to localized nodes.
- [+] GAPLESS PG_CRON ROTATIONA PostgreSQL pg_cron job triggers wizardops.radio_rotate() to keep the station alive, gapless and advancing even with zero active listeners.
Real-Time Database Optimization
PARTIALTrigger-based counters and REPLICA IDENTITY FULL are real. Street Cred is not: it lives in localStorage on one device, not in SQL. Proximity gating on Wiper Notes is not enforced at the database layer either — `fleet_notes` has no path-crossing check.
Live social state at map scale dies on naive queries. The data layer is tuned for constant-cost reads and reflow-free pushes.
- [+] TRIGGER-BASED COUNTERSHeavy COUNT() queries are eliminated via SQL triggers maintaining denormalized counters — Street Cred math resolves as (Likes / (Likes + Dislikes)) * 100 server-side.
- [+] REPLICA IDENTITY FULLWebSocket change feeds ship complete row images so clients patch state surgically, pushing live updates without forcing DOM reflows.
- [+] PROXIMITY GATINGWiper Notes delivery is enforced at the database layer: a message row is only readable when a verified physical path-crossing exists between the two pilots.
// ALSO BUILT
Subsystems The Dossier Left Out
These were missing from the architecture document entirely, and they are the larger half of the product. Each carries the RPC, table or module it can be verified against.
Turn-By-Turn Navigation — The Part Nobody Wrote Down
LIVEStreetWizard is a working GPS, not only a social map, and this was the largest omission in the dossier. Alternative routes with live-traffic ETA and congestion coloured onto the line; visible recalculation when a turn is missed; spoken guidance; lane guidance; current street name; an over-speed chime; compass; route overview; an arrival screen. Speed reads in km/h or mph with the posted limit alongside.
src/components/map/NavExperience.tsxsrc/lib/mapbox.tssrc/lib/units.tsSocial Graph & Private Messaging
LIVEFollows, followers and mutual-friend state, with counts resolved server-side. A real direct-message system with threads, an inbox, read receipts and realtime delivery — none of which appeared in the dossier, which described only proximity Wiper Notes.
fleet_followsfleet_social_countsdm_senddm_threaddm_inboxdm_mark_readThe Wall, Crews & Meets
LIVEA posting feed with likes, comments and pinning, scoped per rider and per crew. Crews carry membership, roles and a public page. Meets carry RSVPs and attached media. Community road reports — add, vote, query-by-proximity — are built and were never mentioned.
fleet_wall_postfleet_wall_feedfleet_wall_likefleet_wall_pinfleet_orgsfleet_org_membersfleet_meetsfleet_meet_rsvpreport_addreport_votereports_nearMedia System & Accounts
LIVERider playlists and a community jukebox with LIVE and RADIO modes, genre filtering, likes and favourites, and a twelve-track ceiling enforced by a SQL trigger rather than by the UI. Accounts are real: unique nicknames, passphrase login, and email-based reset.
fleet_songsfleet_playlistfleet_queuefleet_community_songsfleet_loginfleet_nick_statusfleet_reset_setfleet_reset_confirmOffline-First — Tile Cache & Optimistic Queue
DESIGNEDCanyon roads and industrial-park meets are cellular dead zones, and a GPS that freezes without LTE is not a GPS. The plan is a service worker caching vector tiles ahead of the drive, plus an encrypted client-side queue that flushes when the ping returns. Nothing of this exists yet: there is no service worker in the codebase and no tile cache. The one IndexedDB queue in the repo belongs to the Wizard Ops admin photo uploader, a different application.
Anti-Spoofing — Jitter Analysis & PostGIS Validation
DESIGNEDThe velocity clamp on the odometer is LIVE and shipped. What is still only designed is the layer above it: PostGIS geometry validation on the coordinate stream, and the noise heuristic — a real GPS trace jitters, a synthetic one is mathematically too clean, and a track with no variance gets shadowbanned. PostGIS is not installed on the project and no jitter analysis exists.
B2B Layer — Sponsored Waypoints & Geofenced Drops
DESIGNEDThe revenue model that keeps the no-data-brokerage promise honest: tuning shops, body shops and dynos paying a subscription to appear as verified waypoints, and parts brands sponsoring a meet or a stretch of road with unlockable badges. Sound, and entirely unbuilt — there is no sponsorship table, no billing, no geofence.
Parallax Garage — Structured Build Sheet & Title Transfer
DESIGNEDToday the garage is a roster of vehicle sprites unlocked by level — good, and shipped. The designed version is a relational build sheet: engine code, platform, induction, suspension, tapped from the map to open a spec card, with the avatar and its earned history transferable when the car is sold in real life. None of those columns exist yet.
