Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mobile Strategy

Overview

Mobile support is a Phase 4+ consideration (8+ months out). When we reach this stage, Tauri v2 presents an attractive option for bringing robit to iOS and Android while leveraging existing work.

Why Tauri?

The Case For Tauri

  1. Rust Native: Backend written in Rust, matching our stack
  2. Code Reuse: Can leverage the WASM web app as the frontend
  3. Mobile Support: Tauri v2 (released 2024) officially supports iOS/Android
  4. Performance: Smaller bundle sizes than Electron, native performance
  5. Security: Rust’s memory safety extends to the mobile app

Architecture with Tauri

┌─────────────────────────────────────────────────────────────┐
│                    Mobile App (Tauri)                        │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐   │
│  │                 WebView Frontend                      │   │
│  │  (Compiled from robit-web or React/Vue variant)    │   │
│  └──────────────────────┬───────────────────────────────┘   │
│                         │                                    │
│  ┌──────────────────────▼───────────────────────────────┐   │
│  │                   Tauri Bridge                        │   │
│  │         (JavaScript ← → Rust bindings)                │   │
│  └──────────────────────┬───────────────────────────────┘   │
│                         │                                    │
│  ┌──────────────────────▼───────────────────────────────┐   │
│  │                 Rust Backend                          │   │
│  │  • robit-core (shared logic)                        │   │
│  │  • Platform APIs (mobile-specific)                    │   │
│  │    - Biometric auth                                   │   │
│  │    - Secure enclave for API keys                      │   │
│  │    - Push notifications                               │   │
│  │    - Background sync                                  │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Alternative Approaches

Option 1: Tauri with Web Frontend

Frontend: React/Vue/Svelte or robit-web WASM Backend: robit-core + Tauri APIs

Pros:

  • Familiar web development
  • Rich ecosystem of UI libraries
  • Can share code with web deployment
  • Easy to prototype

Cons:

  • WebView overhead
  • Two UI codebases (terminal vs mobile)
  • Not truly native feel

Best for: Phase 4, quick time-to-market

Option 2: Tauri with Native UI

Use Tauri as a shell but render native UI via egui, iced, or Slint.

Pros:

  • More native performance
  • Rust-native UI libraries
  • Can look like system UI

Cons:

  • Less mature than web frontend
  • Mobile support still evolving
  • Steeper learning curve

Best for: If we want native UI without web tech

Option 3: Native Mobile (Swift/Kotlin)

Build separate iOS (Swift) and Android (Kotlin) apps that communicate with a Rust core.

┌─────────────────────────────────────────────────────────────┐
│                   Native Mobile Apps                         │
├─────────────────────────────────┬───────────────────────────┤
│         iOS App (Swift)          │      Android (Kotlin)     │
│                                  │                           │
│  ┌──────────────────────────┐   │  ┌──────────────────────┐  │
│  │    SwiftUI Interface     │   │  │   Jetpack Compose    │  │
│  └───────────┬──────────────┘   │  └──────────┬───────────┘  │
│              │                   │             │              │
│  ┌───────────▼──────────────┐   │  ┌───────────▼──────────┐   │
│  │   UniFFI Bindings        │   │  │   JNI Bindings       │   │
│  │   (Swift ← → Rust)       │   │  │   (Kotlin ← → Rust)  │   │
│  └───────────┬──────────────┘   │  └──────────┬───────────┘   │
└──────────────┼──────────────────┴─────────────┼───────────────┘
               │                                │
               └────────────────┬───────────────┘
                                │
                   ┌────────────▼────────────┐
                   │      robit-core       │
                   │    (Rust, shared)       │
                   └─────────────────────────┘

Pros:

  • Truly native experience
  • Best performance
  • Platform-specific features

Cons:

  • Three codebases (terminal, iOS, Android)
  • More development effort
  • Requires mobile expertise

Best for: If mobile becomes primary platform

Option 4: Cross-Platform UI (egui, iced, Slint)

Use a Rust-native UI framework that compiles to mobile.

egui:

  • Immediate mode GUI
  • Great for tools/internal apps
  • Not traditionally mobile-focused

iced:

  • Elm architecture
  • Still maturing mobile support
  • Clean, functional approach

Slint:

  • Declarative UI (QML-like)
  • Good mobile support
  • Commercial licensing considerations

Best for: If we want pure Rust, no web tech

Phase 4A: PWA via WASM (Quick Win)

Before building native apps, ensure the WASM web app works well as a PWA:

# robit-web as PWA
- Service worker for offline
- Manifest for install
- Responsive design
- Touch-optimized

Benefits:

  • Users can “install” from browser
  • Works on mobile immediately
  • No app store approval
  • Shares codebase with web

Phase 4B: Tauri Mobile App

Build Tauri v2 app using the PWA as base:

// src-tauri/src/main.rs
fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![
            get_conversations,
            send_message,
            sync_data,
            // Mobile-specific commands
            biometric_auth,
            secure_storage,
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Mobile-specific features:

  • Biometric authentication for API keys
  • Secure enclave storage
  • Background sync when app closed
  • Push notifications for long-running tasks
  • Share extension (share to harness from other apps)

Phase 4C: Native Apps (If Needed)

Only if mobile becomes a primary platform and Tauri limitations are hit.

Tauri + Existing Architecture Integration

Sharing Code with robit-web

harness-tauri/
├── src-tauri/           # Rust backend
│   ├── src/
│   │   ├── main.rs      # Tauri setup
│   │   ├── commands.rs  # JS-callable commands
│   │   └── mobile.rs    # Mobile-specific APIs
│   └── Cargo.toml
├── src/                 # Frontend (can be)
│   ├── robit-web/     # Option A: Use WASM directly
│   └── react-app/       # Option B: React/Vue wrapper
└── tauri.conf.json

Option A: Embed robit-web

Use the existing ratatui-based WASM app inside Tauri:

<!-- Tauri loads robit-web WASM -->
<script type="module">
  import init from './robit-web.js';
  init();
</script>

Pros: Minimal code duplication Cons: Terminal aesthetic may feel odd on mobile

Option B: Mobile-Optimized Frontend

Build a mobile-specific web frontend that uses the same Tauri backend:

Mobile UI (React/Svelte)
├── Uses Tauri API for native features
├── Mobile-optimized layout (not terminal)
└── Can access robit-core via Tauri commands

Pros: Native mobile UX Cons: Separate frontend code

Hybrid Approach

Allow users to choose UI:

#![allow(unused)]
fn main() {
// Tauri command to launch different UIs
#[tauri::command]
fn launch_ui(mode: &str) -> Result<String, String> {
    match mode {
        "terminal" => load_harness_web(),  // TUI in mobile
        "mobile" => load_mobile_ui(),      // Touch-optimized
        _ => Err("Unknown mode".to_string()),
    }
}
}

Mobile-Specific Considerations

Input Methods

Terminal UI on mobile:

  • Virtual keyboard takes half screen
  • Need special key handling (Ctrl, Esc, arrow keys)
  • Could provide on-screen toolbar

Touch gestures:

  • Swipe for navigation
  • Pinch to zoom text
  • Long press for context menus

Data Sync Strategy

Mobile apps need robust sync:

Mobile Device                    Server/Cloud
     │                                │
     ├─── Sync conversations ────────►│
     │                                │
     │◄──────── Updates ──────────────│
     │                                │
     ├─── Offline changes ───────────►│
     │         (queued)               │

Options:

  1. Self-hosted sync: User runs robit-server
  2. Cloud sync: End-to-end encrypted, we host
  3. Peer sync: Device-to-device (LocalSend, etc.)

Security on Mobile

  • Biometric auth: Unlock API keys with FaceID/TouchID
  • Secure enclave: Store credentials in hardware
  • App sandbox: Mobile OS protections
  • Network security: Certificate pinning

Roadmap Integration

Current Plan (Months 1-7)

  • Focus on terminal + web WASM
  • Build solid core
  • Add security features

Mobile Phase (Month 8+)

  • Month 8: PWA improvements
  • Month 9-10: Tauri mobile app (MVP)
  • Month 11-12: Mobile-specific features
  • Month 13+: App store release

Prerequisites for Mobile

Before starting mobile:

  • Core features stable
  • Conversation sync working
  • Security model proven
  • Server API designed (for cloud sync)
  • Developer accounts (Apple Developer, Google Play)

Decision Matrix

CriteriaTauri/WebNativePWA Only
Dev effortMediumHighLow
Native feelGoodBestFair
Code sharingGoodPoorExcellent
App store presenceYesYesNo
PerformanceGoodBestGood
Offline capableYesYesYes
MaintenanceMediumHighLow

Recommendation: Start with PWA (immediate), add Tauri mobile (Phase 4), evaluate native only if traction demands it.

Open Questions

  1. Do mobile users want a terminal UI? Or should mobile be touch-optimized?
  2. What’s the sync story? Self-hosted, cloud, or peer-to-peer?
  3. Monetization? Free app, subscription for sync, one-time purchase?
  4. iPad/Tablet support? Different from phone UI?

Conclusion

Tauri v2 is the pragmatic choice for mobile:

  • Leverages existing Rust codebase
  • Can use web frontend (existing work)
  • Official mobile support (not experimental)
  • Path to app stores

But first: Make the web PWA excellent. Many users’ mobile needs will be satisfied by a well-designed PWA, deferring the need for native apps.