Tauri Specta
Generate fully type-safe TypeScript bindings for your Tauri commands and events.
Repository Health
Technical Analysis
Tauri Specta is a Rust crate that connects Tauri’s IPC command/event system to Specta’s type-reflection engine, automatically generating matching TypeScript types and typed invoke wrappers for every #[tauri::command] and event in a Tauri application. Instead of hand-writing TypeScript interfaces that mirror your Rust structs and manually keeping them in sync, you annotate commands with a derive macro and export a single generated .ts file the frontend imports directly.
Built by the Specta project (also behind rspc), Tauri Specta targets Tauri v2 apps and eliminates an entire class of frontend/backend type-drift bugs common in Tauri projects, where the Rust command signature and the JS invoke() call can silently fall out of sync.
What You Get
- A
#[specta::specta]-compatible builder API (Builder::new().commands(...).events(...)) that registers commands/events for export - Automatic TypeScript type + function-signature generation for every registered Tauri command, matching Rust struct/enum shapes exactly
- Type-safe event emission and listening helpers generated alongside commands
- Optional JavaScript (untyped) export mode alongside the default TypeScript mode via feature flags
- Integration with the broader Specta ecosystem (
specta,specta-typescript) for consistent type generation across multiple Rust-to-TS tools
Common Use Cases
- Generating a single source-of-truth TypeScript API surface for a Tauri v2 desktop app’s Rust backend commands
- Keeping frontend event listeners type-safe when the Rust backend emits typed events to the webview
- Avoiding manual duplication of Rust DTOs as hand-written TypeScript interfaces in a Tauri + React/Vue/Svelte app
- Powering internal tooling or plugin ecosystems built on Tauri where multiple frontends consume the same typed command surface
Under The Hood
Architecture: The crate builds around a Builder (src/builder.rs) that collects registered commands (src/commands.rs) and events (src/event.rs), each described via the specta crate’s type-reflection derive; a language-backend abstraction (src/lang.rs, src/lang/) then renders that collected schema into TypeScript (or JS) source, keeping code generation decoupled from the type-collection step. Tech Stack: Pure Rust, built on top of the specta and specta-typescript crates from the same organization, tauri v2 (with the specta feature) for command/event registration, and serde/serde_json for schema serialization; a companion tauri-specta-macros crate supplies the derive-feature proc macros. Code Quality: tests/ covers command signature generation, option-type references, and identifier casing (casing.rs) via cargo test --all --all-features, with an examples/app Tauri project serving as an integration/manual-test target; the workspace uses shared lints ([lints] workspace = true) for consistency across crates. API Design: The public surface is a fluent builder (Builder::new().commands(collect_commands![...])) plus attribute macros on existing #[tauri::command] functions, requiring minimal changes to an existing Tauri command’s signature to opt into type generation, with a single generated .ts file consumed like any other frontend module.
Used by 3 apps in this directory
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
Epicenter
Knowledge Management · Note Taking · Developer Tools
A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.
Handy
Productivity
Free, offline, open-source speech-to-text that pastes directly into any app on Windows, macOS, and Linux.