Skip to main content

Overview

VoiceTypr is built with Tauri v2, combining a Rust backend for performance-critical operations with a React 19 frontend for the user interface.

Project Structure

Frontend (src/)

Backend (src-tauri/src/)

Key Modules

Frontend Modules

Components

  • components/ui/ - shadcn/ui components (Button, Dialog, Select, etc.)
  • components/tabs/ - Main UI panels (RecordingTab, ModelsTab, SettingsTab)
  • components/sections/ - Reusable sections (ModelCard, HotkeySelector)

State Management

  • React hooks - Local component state and side effects
  • Zustand stores - Global app state (state/)
  • Tauri events - Backend-to-frontend communication

Custom Hooks

  • useTranscription - Manage transcription lifecycle
  • useRecording - Handle audio recording state
  • useSettings - Persist and sync settings
  • useModelDownload - Track model download progress

Backend Modules

Commands (commands/)

Tauri command handlers invoked from the frontend:

Audio (audio/)

  • CoreAudio (macOS) - Native audio capture
  • CPAL (Windows) - Cross-platform audio library
  • Real-time audio processing and buffering

Whisper (whisper/)

  • Whisper AI model management
  • Transcription engine with Metal (macOS) or Vulkan (Windows) acceleration
  • Model preloading and caching

Parakeet (parakeet/)

  • Swift sidecar integration (macOS only)
  • Apple Neural Engine acceleration
  • IPC communication with sidecar process

State (state/)

  • Thread-safe state management with Arc<Mutex<T>>
  • Persistent settings storage
  • Model cache management

Communication Patterns

Frontend → Backend (Commands)

Frontend invokes backend commands using @tauri-apps/api:

Backend → Frontend (Events)

Backend emits events to notify the frontend:

Event Coordination

The EventCoordinator class manages event subscriptions:

State Management

Frontend State

React Hooks for local state:
Zustand for global state:

Backend State

Shared state with Arc<Mutex<T>>:
Tauri State for command handlers:

Platform-Specific Features

macOS

  • NSPanel - Pill window that doesn’t steal focus
  • CoreAudio - Native audio capture
  • Metal acceleration - GPU-accelerated Whisper
  • Parakeet Swift sidecar - Apple Neural Engine support
  • Global hotkeys - System-wide recording trigger

Windows

  • CPAL audio - Cross-platform audio capture
  • Vulkan acceleration - GPU-accelerated Whisper (x64 only)
  • Global hotkeys - System-wide recording trigger
  • Auto-updates - Built-in updater

Security Architecture

Tauri Capabilities

Permissions defined in src-tauri/capabilities/:

Secure Storage

API keys encrypted using AES-GCM with PBKDF2 key derivation:

Performance Considerations

Model Preloading

Whisper models preload on app startup to reduce first-transcription latency:

Clipboard Preservation

Text insertion preserves user clipboard, restoring after 500ms:

Async Commands

All I/O operations use async Rust for non-blocking execution:

Next Steps