Skip to content

Instantly share code, notes, and snippets.

@scandav
Last active August 30, 2024 17:58
Show Gist options
  • Save scandav/d619ede81369b760e075a297a9840b48 to your computer and use it in GitHub Desktop.
Save scandav/d619ede81369b760e075a297a9840b48 to your computer and use it in GitHub Desktop.

Use Tauri with Full JS/TS

  • Tauri has a frontend and a backend service. It does not ship with a nodejs backend option according to this and this. The tool to do everything with JS is Electron.
  • If you really want to use Tauri with full JS/TS stack, you can load the backend as a binary sidecar, the same way you would compile flask to embed it in Electron.

Use Tauri with Rust backend

This is the designated use case for Tauri:

  • Backend: Rust
  • Frontend: TS and React

Possibilities for video stream:

  • MJPEG through http and custom protocol in Tauri register_uri_scheme_protocol Docs. Ongoing discussion for streaming content to frontend in Tauri: tauri-apps/tauri#5385
  • MJPEG through websocket-plugin. Not stable, no v1.0.0 release yet.
  • Create your own streaming server outside Tauri and connect through localhost-plugin. Not ideal.
  • WebRTC (Real Time Communication): access camera from frontend.
    • Most likely won't work with custom camera other than integrated one.
    • Also, saving video to FS might be difficult, at least more difficult than other solutions.
    • UDP protocol is not safe for important data. No built-in signalling.
    • Community has been waiting for WebRTC example, link.

Inspirations:

Use Tauri with Dioxus

Full Rust application. Dioxus is far behind React or any other JS frontend framework, see roadmap

Other Rust GUI options:

(Webcam) Streaming options:

Community posts/threads:

  • https://www.reddit.com/r/rust/comments/vzz4mt/advice_for_the_next_dozen_rust_guis/
    • Do not go with Qt;
    • Again, do not go with Qt;
    • Druid lacks a lot of widgets;
    • egui ruled out because "its container/size story is awful";
    • Slint could be a good option according to this post, as is it like QML in Rust; there is a branch trying to embed Gstreamer video feed into Slint, still under progress.
    • Dioxus could be a good option (Web-based desktop app like Tauri, similar to React concepts);
    • Tauri is a good option, but could have issues in our case with framebuffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment