Docs

LLM Integration Guide

This file is written for AI coding agents integrating TauriWatch into an existing Tauri v2 project.

Goal

Add TauriWatch observability with the minimum correct changes:

  • Rust plugin installed and registered.
  • Frontend package installed.
  • tauri.conf.json plugin config added.
  • Global frontend error handlers installed.
  • At least one test log emitted on app startup.

Required Inputs

Ask the user for these values if they are not present:

  • appId: stable slug for the app, for example desktop-admin.
  • apiKey: TauriWatch app API key.
  • endpoint: API base URL, for example https://tauri-watch.cloud.alkkmia.com.
  • environment: usually development, staging, or production.
  • releaseVersion: app version, usually from package/crate version.

Never invent an API key.

Preferred Integration Path

Use the Tauri plugin path first.

Commands:

cd src-tauri
cargo add tauri-plugin-tauri-watch
cd ..
npm install @alkkmia/tauri-plugin-tauri-watch-api

If the app also needs session replay, install the standalone JS SDK too:

npm install @alkkmia/tauri-watch-sdk

Rust Edit

Find the Tauri builder, usually in:

  • src-tauri/src/main.rs
  • src-tauri/src/lib.rs

Add:

.plugin(tauri_plugin_tauri_watch::init())

Example:

tauri::Builder::default()
    .plugin(tauri_plugin_tauri_watch::init())
    .run(tauri::generate_context!())
    .expect("error while running tauri application");

Do not remove existing plugins.

Tauri Config Edit

Open src-tauri/tauri.conf.json and merge this into the top-level object:

{
  "plugins": {
    "tauri-watch": {
      "appId": "REPLACE_APP_ID",
      "apiKey": "REPLACE_API_KEY",
      "endpoint": "https://tauri-watch.cloud.alkkmia.com",
      "environment": "production",
      "releaseVersion": "1.0.0",
      "enabled": true,
      "batchSize": 20,
      "flushIntervalMs": 3000,
      "retryAttempts": 3
    }
  }
}

If a plugins object already exists, preserve all existing keys and only add tauri-watch.

Frontend Edit

Find the frontend entry file, commonly:

  • src/main.ts
  • src/main.tsx
  • src/App.tsx

Add:

import { installGlobalHandlers, logInfo } from "@alkkmia/tauri-plugin-tauri-watch-api";

installGlobalHandlers();
void logInfo("App started");

If the app has a bootstrap function, place this near the start of the app lifecycle.

Session Replay Add-On

Only add this when the user explicitly wants replay.

Install:

npm install @alkkmia/tauri-watch-sdk

Initialize:

import { initTauriWatch, installGlobalHandlers } from "@alkkmia/tauri-watch-sdk";

initTauriWatch({
  appId: "REPLACE_APP_ID",
  apiKey: "REPLACE_API_KEY",
  endpoint: "https://tauri-watch.cloud.alkkmia.com",
  environment: "production",
  releaseVersion: "1.0.0",
  sessionReplay: {
    enabled: true,
    maxEvents: 8000,
    flushOnStop: true,
    snapshotIntervalMs: 15000,
  },
});

installGlobalHandlers();

Privacy requirement:

  • Add data-tauriwatch-mask to sensitive DOM regions.
  • Do not record screens containing secrets, payment data, or personal documents unless the product has explicit user consent.

Validation

Run:

npm run build
cd src-tauri
cargo check

Then run the app and verify:

  • A startup log appears in TauriWatch Events.
  • A thrown frontend error appears as an error event.
  • No secrets are visible in metadata.

Common Mistakes

  • Do not use npm run tauri add tauri-watch; it is not supported yet.
  • Do not import the plugin API from @alkkmia/tauri-watch-sdk; use @alkkmia/tauri-plugin-tauri-watch-api.
  • Do not overwrite existing plugins in tauri.conf.json.
  • Do not commit real API keys to public repositories.
  • Do not enable session replay on sensitive flows without masking and consent.