Files
2026-11-16 10:30:06 +01:00

3.6 KiB

ClipForge Architecture

ClipForge is a Windows-first, local-first desktop app. A Tauri 2 shell hosts the TypeScript/Vite UI in WebView2; the Rust library in src/ contains recorder, capture, storage, and integration code. src-tauri/src/main.rs owns application state, exposes Tauri commands, registers hotkeys, and runs background workers. Capture and game events use Windows APIs and local endpoints; the app does not inject into games.

Codebase map

Area Main files Responsibility
Desktop shell src-tauri/src/main.rs, src-tauri/tauri.conf.json Commands, lifecycle, tray, hotkeys, workers, installer configuration
UI ui/src/main.ts, ui/styles.css Recording, library, auto clip, uploads, settings, onboarding
Recording src/recorder.rs, src/ram_buffer.rs, src/media.rs Session state, rolling segments, clip extraction, thumbnails
Capture and audio src/capture.rs, src/native_wgc.rs, src/native_audio.rs Native Windows Graphics Capture, WASAPI, FFmpeg fallback
Games and events src/game_detection.rs, src/game_watcher.rs, src/integrations.rs, src/gsi_config.rs Game detection, League polling, Valve GSI normalization
Persistence src/database.rs, src/library.rs, src/settings.rs, src/storage.rs SQLite clip and upload history, versioned JSON settings, file layout
Other services src/upload.rs, src/updater.rs, src/screenshot.rs, src/crashlog.rs Upload providers, GitHub release updates, screenshots, crash reports

Capture and clip flow

start_capture selects the active game and capture quality, checks free space, then starts a rolling segment recorder. It prefers native Windows Graphics Capture with Media Foundation H.264 when the requested audio setup is supported. Separate system and microphone tracks use the FFmpeg backend when available. FFmpeg falls back through Desktop Duplication (ddagrab) and gdigrab. Native audio uses WASAPI loopback and microphone input; its output is a mixed track.

Recent segments are held in a capped RAM buffer and on disk. Manual hotkeys and normalized game events select a time window, render an MP4, make a thumbnail, and add metadata to SQLite. Stopping capture finalizes the segments into a full-session MP4. Background workers refresh game detection, process auto clips, and enforce storage limits. The Tauri shell emits clip and storage events so the UI can refresh its views.

Data and integrations

The default library is ~/Documents/ClipForge. It contains clips, thumbnails, sessions, rolling buffer files, settings, database data, and logs. The clip directory can be changed in Settings; the other folders remain under the library root. Screenshots are saved to ~/Pictures/ClipForge. Settings are versioned in settings.json; the SQLite schema uses PRAGMA user_version migrations.

League events are polled from the local Live Client endpoint. A local Valve GSI receiver listens on 127.0.0.1:49321 for CS2/Dota-style posts. Upload adapters support Catbox, Litterbox, and custom multipart HTTP endpoints, with attempt history stored in SQLite. Updates are checked against GitHub Releases and require a newer version with an installer asset.

Current limits

The recorder runs in the Tauri process, so capture does not survive an app restart. Native capture mixes system and mic audio into one track; separate tracks require FFmpeg. The current Valve mapping focuses on CS2 round/bomb events and Dota 2 match transitions. Capture still needs manual QA across gaming hardware. See implementation status for the detailed feature and remaining-work inventory.