waylog
Architecture

Desktop Client (Tauri)

The architecture of the Waylog desktop application.

The Waylog desktop client is the critical bridge between Euro Truck Simulator 2 / American Truck Simulator and the cloud. Built on Tauri v2, it combines a lightweight Rust backend with a modern React frontend.

The Rust Backend

The core responsibility of the Rust layer (src-tauri) is to interface with the game's memory. It utilizes the scs-sdk-telemetry crate to read data from the SCS Telemetry SDK's shared memory space.

Polling & Event Emission

  • High-Frequency Polling: The Rust service polls the shared memory approximately every 100ms.
  • Delta Filtering: To optimize inter-process communication (IPC), the backend only emits telemetry-update events to the frontend when significant values (speed, RPM, location, job state) change.
  • Heartbeat: A dedicated telemetry-heartbeat event fires every 5 seconds to confirm that the game connection remains active.

The React Frontend

The frontend is responsible for visualizing the data and managing the synchronization state with the server.

TypeScript State Machine

The raw telemetry stream is continuous and noisy. The frontend implements a strict state machine to derive business logic:

  • Detects transitions from NO_JOB to ON_JOB.
  • Identifies job completion (DELIVERED) or failures (CANCELLED / ABANDONED).
  • Monitors sudden spikes in telemetry values to log discrete events, such as traffic fines or toll gate passes.

Offline-First Architecture

Network reliability cannot be guaranteed while driving. The client employs an Outbox Pattern:

  1. All job updates, GPS route breadcrumbs, and events are immediately written to a local IndexedDB.
  2. A background synchronization worker continuously attempts to flush this outbox to the server.
  3. Job payloads utilize deterministic composite keys to ensure that retries result in safe, idempotent upserts rather than duplicated data.

On this page