Lurker News
A year ago, my co-founder launched Desktop Docs here on HN. It's a Mac app we built with Electron that uses CLIP embeddings to search photos and videos locally with natural language. We got positive feedback from HN and our first paying customers, but the app was almost 1GB and clunky to use.

TLDR; rebuilding in Rust was the right move.
So we rewrote the app with Rust and Tauri and here are the results:
- App size is 83% smaller: 1GB → 172MB - DMG Installer is 70% smaller: 232MB → 69.5MB - Indexing files is faster: A 38-minute video now indexes in ~3 minutes instead of 10-14 minutes - Overall more stability (old app used to randomly crash)
The original version worked, but it didn't perform well when you tried indexing thousands of images or large videos. We lost a lot of time struggling to optimize Electron’s main-renderer process communication and ended up with a complex worker system to process large batches of media files.
For months we wrestled with indecision about continuing to optimize the Electron app vs. starting a full rebuild in Swift or Rust. The main thing holding us back was that we hadn’t coded in Swift in almost 10 years and we didn’t know Rust very well.
What finally broke us was when users complained the app crashed their video calls just running in background. I guess that’s what happens when you ship an app with Chromium that takes up 200mb before any application code.
Today the app still uses CLIP for embeddings and Redis for vector storage and search, except Rust now handles the image and video processing pipeline and all the file I/O to let users browse their entire machine, not just indexed files.
For the UI, we decided to rebuild it from scratch instead of porting over the old UI. This turned out well because it resulted in a cleaner, simpler UI after living with the complexity of the old version.
The trickiest part of the migration was learning Rust. LLMs definitely help, but the Rust/Tauri community just isn’t as mature compared to Electron. Bundling Redis into the app was a permissioning nightmare, but I think our solution with Rust handles this better than what we had with Electron.
All in, the rebuild took about two months and still needs some more work to be at total parity with its Electron version, but the core functionality of indexing and searching files is way more performant than before and that made it worth the time. Sometimes you gotta throw away working code to build the right thing.
AMA about Rust/Tauri migration, Redis bundling nightmares, how CLIP embeddings work for local semantic search, or why Electron isn't always the answer.

Comments (443) 84 threads

Show all comments

Showing thread 2 of 84

platevoltage3 replies#
I did the same thing with one of my projects. I built a simple webcam viewer that is optimized for USB microscopes as I couldn't find anything out there for this purpose. Basically all of the functionality was implemented in the renderer. As I was planning for App Store submission, I realized that a 500mb webcam viewer might not be the best thing. I decided to port it to Tauri V2 and got it down to about 15mb.
correa_brian1 reply#
That's pretty sick. Nice work. What's it called? We're working on the app store submission this week.
platevoltage1 reply#
I ended up calling it Microscopic View. I made a webpage for it and everything.

https://microscopic-view.jgarrettcorbin.com
I got tied up with other projects while I was trying to navigate the submission process (it was my first time), so it's not up yet, but I'd be happy send you a build if you want to check it out.

djfergus1 reply#
I’d love to see something like this optimized for low end Android - old tablets are almost free and otherwise useless even for web browsing.

Also, what is your recommendation for finding a cheap usable microscope? My brief forays to aliexpress have just resulted in frauds and trash.

Continue this thread — 1 reply

smusamashah3 replies#
What is the difference between Tauri and Electron. From what I understand both use browser for rendering, except electron ships the whole browser while Tauri use the browser already there on the system.
SpaceL10n2 replies#
That's part of it, but also Tauri uses Rust on the backend while Electron uses Node. Electron is way more mature with a larger developer community, but Tauri keeps gaining momentum. If memory safety, bundle size, and performance are important to you, Tauri is a nice choice. Electron is not bad but there's a reason there are so many new players.
amelius2 replies#
> If memory safety

But Tauri is just a wrapper around WebKit, which is written mostly in C++.

Continue this thread — 2 replies

whywhywhywhy#
The main significant difference, Electron bundles it's own version of Chrome which means you have very few cross platform issues when shipping Mac/Windows/Linux. This trades off a few hundred meg for consistency in rendering.

Tauri uses the OS engine which means Windows uses Edge presumably and Mac uses Safari's Webkit so you're going to have rendering differences and feature differences there.

platevoltage#
Exactly. Electron ships with a copy of chromium in every app, while Tauri uses the native WebView of the operating system.

Electron is also way more mature, but Tauri is improving.

bloomca#
Tauri uses native WebView (can be very outdated in old OS versions) and compiles to native machine code. Electron bundles full Chromium (rendering engine for HTML/CSS+V8 for JS) AND Node.js for your app code.

Honestly if there was an Electron without Node.js which would use literally any compiled language (although Rust is probably too low level), it would've been more tolerable.

itsibitzi1 reply#
Out of interest, how did you stream the video data to the frontend?