Can I build Drift in Tauri?

HEAD
731267dUpdate file conversion count in README
This post might have stale content, as HEAD is 20 commits ahead.
Avatar of uvenkatateja
uvenkatateja
posted

Can I build this in tauri tell me ?

Avatar of google/gemini-3-flash
Gemini 3 Flash
commented

Yes, you can definitely build Drift in Tauri, but it is not a direct "plug-and-play" migration. Since Drift relies on several native features (like screen capturing and global input hooks), you would need to replace the Electron-specific parts with Rust equivalents.

Here is the breakdown of what would be required to port Drift to Tauri:

###1. Frontend (Next.js)

Drift is built with Next.js. Tauri supports Next.js perfectly.

  • The Good: You can keep almost all of your UI components, Tailwind CSS, and Framer Motion logic.
  • The Change: You would likely want to switch to a static export (output: 'export' in next.config.mjs) so that Tauri can bundle the frontend as a set of static files, making the app much faster and smaller.

###2. Screen Capturing

Currently, the Electron version uses desktopCapturer.getSources() to let users pick a screen or window.

  • Tauri equivalent: Tauri doesn't have a built-in desktopCapturer. You would need to use a plugin like tauri-plugin-screencapture or write custom Rust code to enumerate windows and screens, then pass those IDs to the frontend to be used with navigator.mediaDevices.getUserMedia.

###3. Global Click Tracking & Hotkeys

Drift uses uiohook-napi in the Electron main process to track mouse clicks and hotkeys globally (even when the app is in the background). This is how it knows where to "auto-zoom."

  • Tauri equivalent: You would replace this Node.js native module with Rust crates like rdev or enigo. These allow you to listen for system-wide events in Rust and then "emit" them to your Next.js frontend via Tauri's event system.

###4. Video Processing (FFmpeg)

The project uses @ffmpeg/ffmpeg (the WASM version).

  • The Good: This will work exactly the same in Tauri as it does in Electron/Chrome, as it runs entirely in the browser context (WebView).

###5. IPC (Communication)

  • Electron: Uses ipcRenderer and ipcMain via preload.js.
  • Tauri: Uses invoke for calling Rust functions from JS and listen/emit for two-way event streaming. You would need to rewrite the electron/preload.js and electron/main.js logic into a Tauri main.rs file.

###Why move to Tauri?

  • Smaller Bundle: The current Electron app is likely 100MB+. A Tauri version would be ~10MB.
  • Performance: Rust-based global hooks are generally more efficient and stable than the uiohook-napi wrapper used in Node.
  • Security: Tauri has a more restrictive (and thus secure) default posture than Electron.

###Summary

FeatureElectron implementationTauri Port
UINext.jsNext.js (Static Export)
Window MgmtBrowserWindowtauri::Window
Screen CapturedesktopCapturertauri-plugin-screencapture or custom Rust
Click Trackinguiohook-napirdev or enigo (Rust crates)
Video RenderingCanvas + WebWASMCanvas + WebWASM (No change)

Verdict: It is a very feasible project for Tauri, especially if you want a lightweight "Cinema-grade" recorder. However, expect to write 100-200 lines of Rust to handle the system-level hooks and screen selection.


END OF POST

Can I build Drift in Tauri? — diiviikk5/Drift