Skip to content

overview architecture

Douwe de Vries edited this page Jul 1, 2026 · 1 revision

Architecture

Load Rift has a React/Vite frontend, a typed Tauri bridge, and a Rust backend that owns collection state and k6 process state. The boundary between frontend and backend is the LoadRiftApi interface in src/lib/loadrift/api.ts.

System shape

graph TD
    subgraph Frontend
        App[src/app/App.tsx]
        Hooks[src/features and src/app/hooks]
        Types[src/lib/loadrift/types.ts]
        TauriClient[src/lib/tauri/client.ts]
    end
    subgraph Backend
        Commands[src-tauri/src/commands]
        State[src-tauri/src/state.rs]
        Importing[src-tauri/src/importing]
        K6Runtime[src-tauri/src/k6]
        Events[src-tauri/src/events.rs]
    end
    App --> Hooks
    Hooks --> Types
    Hooks --> TauriClient
    TauriClient -->|invoke| Commands
    Commands --> State
    Commands --> Importing
    Commands --> K6Runtime
    K6Runtime --> Events
    Events -->|k6 events| TauriClient
Loading

Components

Component Source path Role
React workspace src/app/App.tsx Owns the top-level workflow and passes state/actions to UI sections
Feature hooks src/features/ Encapsulate collection import, config validation, smoke tests, and k6 run state
Typed API src/lib/loadrift/api.ts Frontend contract for commands and event subscriptions
Shared models src/lib/loadrift/types.ts, src-tauri/src/models.rs Mirrored TypeScript and Rust data shapes
Shared app state src-tauri/src/state.rs Holds generated script, runtime collection, latest metrics, latest result, and active process
Postman importer src-tauri/src/importing/parser.rs Extracts folders, requests, variables, headers, bodies, and request IDs
k6 process layer src-tauri/src/k6/process/runtime.rs Resolves k6, writes temp artifacts, starts/stops child processes, and records completion

Runtime data flow

sequenceDiagram
    participant User
    participant React as React app
    participant Tauri as Tauri commands
    participant Importer as Importing module
    participant K6 as k6 process
    participant Events as Tauri events

    User->>React: Select collection JSON
    React->>Tauri: import_collection_from_file
    Tauri->>Importer: parse + generate script
    Importer-->>Tauri: CollectionInfo + runtime collection
    User->>React: Configure and start
    React->>Tauri: start_test
    Tauri->>K6: k6 run script.js
    K6-->>Events: output + JSON metrics
    Events-->>React: k6:output and k6:metrics
    K6-->>Tauri: summary.json
    Tauri-->>React: k6:complete
Loading

Language footprint

Rust is the largest source surface because the backend owns parsing, runtime validation, k6 execution, reporting, and release safety checks. The frontend is split across TSX UI components and TypeScript hooks/utilities.

xychart-beta
    title "Source lines by language"
    x-axis ["Rust", "TSX", "TypeScript", "CSS", "Python", "Shell"]
    y-axis "Lines" 0 --> 9500
    bar [9263, 4473, 2554, 1404, 471, 354]
Loading

For the feature-level walkthrough, start with Load test workflow.

Clone this wiki locally