Vayu System Architecture¶
Vayu uses a Sidecar Architecture that decouples the user interface from the execution engine. This separation allows each component to be optimized for its specific purpose:
- The Manager (Electron/React): Optimized for user experience
- The Engine (C++): Optimized for raw performance
High-Level Architecture¶
┌─────────────────────────────────────────────────────────────────────┐
│ Vayu Application │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────────┐ │
│ │ THE MANAGER │ │ THE ENGINE │ │
│ │ (Electron + React) │ │ (C++) │ │
│ │ │ │ │ │
│ │ ┌───────────────────┐ │ │ ┌───────────────────────┐ │
│ │ │ Request Builder │ │ │ │ HTTP Server │ │
│ │ │ Response Viewer │ │ HTTP │ │ (cpp-httplib) │ │
│ │ │ Dashboard │◄─┼──────┼─►│ Port: 9876 │ │
│ │ │ Collections │ │ │ └───────────────────────┘ │ │
│ │ └───────────────────┘ │ │ │ │ │
│ │ │ │ │ ▼ │ │
│ │ │ │ │ ┌───────────────────────┐ │
│ │ ▼ │ │ │ Thread Pool │ │
│ │ ┌───────────────────┐ │ │ │ ┌─────┐ ┌─────┐ │ │
│ │ │ Sidecar Manager │ │ │ │ │ W1 │ │ W2 │ ... │ │
│ │ │ (spawn/kill) │ │ │ │ └──┬──┘ └──┬──┘ │ │
│ │ └───────────────────┘ │ │ └─────┼──────┼─────────┘ │
│ │ │ │ │ │ │
│ └─────────────────────────┘ │ ▼ ▼ │
│ │ ┌───────────────────────┐ │
│ │ │ Event Loop │ │
│ │ │ (curl_multi) │ │
│ │ └───────────────────────┘ │
│ │ │ │
│ │ ▼ │
│ │ ┌───────────────────────┐ │
│ │ │ Script Engine │ │
│ │ │ (QuickJS) │ │
│ │ └───────────────────────┘ │
│ │ │ │
│ │ ▼ │
│ │ ┌───────────────────────┐ │
│ │ │ SQLite Database │ │
│ │ │ (Collections, Runs) │ │
│ │ └───────────────────────┘ │
│ │ │
│ └─────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
The Manager (Electron + React)¶
The Manager is the "face" of Vayu-a standard Electron application that provides the graphical interface.
Key Responsibilities: - Request building and editing - Collection management - Environment variable management - Real-time load test dashboard - Run history viewing
Technology Stack: - Electron 28: Desktop app framework - React 19: UI framework - TypeScript 5: Type safety - Zustand: UI state management - TanStack Query: Server state and caching - Radix UI: Accessible component primitives - Tailwind CSS: Styling
See App Architecture for detailed information.
The Engine (C++)¶
The Engine is the "muscle"-a headless daemon optimized for maximum I/O throughput.
Key Responsibilities: - HTTP request execution (libcurl) - Load test orchestration - Script execution (QuickJS) - Metrics collection - Data persistence (SQLite)
Technology Stack: - C++20: Core language - cpp-httplib: HTTP server - libcurl: HTTP client (HTTP/1.1, HTTP/2, HTTP/3) - QuickJS: JavaScript engine for scripts - SQLite: Embedded database - sqlite_orm: C++ ORM
See Engine Architecture for detailed information.
Communication Protocol¶
The Manager communicates with the Engine via a localhost HTTP API on port 9876.
Request/Response Flow¶
Manager Engine
│ │
│ POST /execute │
│ {method, url, headers, body} │
├───────────────────────────────────►│
│ │
│ 200 OK │
│ {status, headers, body, timing} │
│◄───────────────────────────────────┤
Load Test Flow¶
Manager Engine
│ │
│ POST /runs │
│ {request, mode, duration, ...} │
├───────────────────────────────────►│
│ │
│ 200 OK {runId} │
│◄───────────────────────────────────┤
│ │
│ GET /runs/{runId}/live (SSE) │
├───────────────────────────────────►│
│ │
│ event: metrics │
│ data: {rps, latency, ...} │
│◄───────────────────────────────────┤
│ (repeated) │
│ event: complete │
│◄───────────────────────────────────┤
│ │
│ GET /runs/{runId}/report │
├───────────────────────────────────►│
│ │
│ 200 OK {summary, latency, ...} │
│◄───────────────────────────────────┤
See Engine API Reference for complete endpoint documentation.
Sidecar Pattern¶
The Engine runs as a separate process managed by the Electron main process:
- Engine Startup: Electron spawns the
vayu-enginebinary on app launch - Health Monitoring: Manager polls
/healthendpoint to verify connectivity - Graceful Shutdown: Engine is stopped when Electron app quits
Development vs Production:
- Development: Engine binary at engine/build/vayu-engine
- Production: Engine binary packaged in Vayu.app/Contents/Resources/bin/vayu-engine
See App Architecture - Sidecar for implementation details.
Data Flow¶
Single Request Execution¶
- User builds request in RequestBuilder
- Variables resolved in frontend (
{{baseUrl}}→https://api.example.com) - Manager sends
POST /executeto Engine - Engine executes HTTP request via libcurl
- Engine runs pre-request script (if provided)
- Engine runs test script (if provided)
- Engine returns response with timing and test results
- Manager displays response in ResponseViewer
Load Test Execution¶
- User configures load test (mode, duration, concurrency)
- Manager sends
POST /runsto Engine - Engine starts load test and returns
runId - Manager connects to SSE stream (
/runs/{runId}/live) - Engine streams real-time metrics (RPS, latency, errors)
- Manager updates dashboard in real-time
- When test completes, Manager fetches final report (
/runs/{runId}/report)
Variable Resolution¶
Variables are resolved with priority: Environment > Collection > Global
- Manager fetches globals, collections, and environments
- Builds flat map with resolution priority
- Replaces
{{variableName}}patterns in URL, headers, body - Resolved request sent to Engine
Security¶
- Script Sandboxing: QuickJS contexts are isolated with no filesystem or network access
- Local-Only Communication: Control API only binds to
127.0.0.1:9876 - Context Isolation: Electron renderer runs in isolated context (no Node.js access)
- No Cloud Sync: All data stored locally in SQLite database
Performance Characteristics¶
- Engine: Tens of thousands of requests per second (target/hardware dependent; ~45k req/s tuned on loopback in internal testing)
- Lock-Free Design: High-performance metrics collection with minimal contention
- Async I/O: Uses
curl_multifor concurrent request handling - Load models:
constant_rpsis open-loop (dispatch at a fixed rate);constant_concurrency,ramp_up, anditerationsare closed-loop (hold a target in-flight count). See Engine Architecture. - Efficient Caching: TanStack Query caches server responses in Manager
File Locations¶
Development¶
- Engine Binary:
engine/build/vayu-engine - Engine Data:
engine/data/(database, logs) - App Source:
app/src/ - App Build:
app/dist/
Production¶
- macOS:
Vayu.app/Contents/Resources/bin/vayu-engine - Windows:
resources/bin/vayu-engine.exe - Linux:
resources/bin/vayu-engine - Data Directory:
- macOS:
~/Library/Application Support/vayu/ - Windows:
%APPDATA%/vayu/ - Linux:
~/.config/vayu/
See: Engine Architecture | App Architecture | Engine API Reference