171 points · by merlindru · 9mo ago · 59 comments
Electrobun lets you open/manipulate/close webview windows and communicate with them using typed rpc. It also handles building, code signing, and notarization.
And because I'm using Bun, running an HMR + React + Tailwind server is just one command (`bun ./index.html`) or like 5 lines of code. Pass --console and the webview's console.log()s get streamed to your Terminal too.
There's tons of other things Electrobun does that I haven't even mentioned, because I haven't interacted much with them yet. E.g. I know that it lets you show platform-native notifications, prompts/popups, etc.
There also is a very impressive updating mechanism that relies on a bsdiff implementation written in Zig. You just ship the deltas, so updates to very large apps are just a few KBs most of the time.
It's genuinely a very productive stack and impressive piece of tech.
[1] Not affiliated - I just like the project.
[2]: The API and implementation was clear, so I'll cautiously say this is not a case of "rewrites are always faster". In fact, the Tauri version was a rewrite too :)
We just hit v1 - stable which means I've locked down the architecture. If you run into any bugs or need specific apis that you miss from Electron or Tauri please open Github issues and I'll prioritize them. I shipped 50,000 lines of code changes stabilizing and polishing electrobun for v1 over the last month.
Here's a video demo of Colab (also open source) (a hybrid web browser + code editor + PTY terminal) that is built with Electrobun https://www.youtube.com/watch?v=WWTCqGmE86w
Electrobun uses the system webview by default, but a lot of the hello worlds feature the bundleCEF option. Because Electrobun is architected to be webview agnostic when servo and ladybird are ready they should be drop-in alternatives.
Electrobun apps also auto generate a zstd self-extraction wrapper and patch files with every release, so your initial download will be much smaller than if you'd used zip and your updates will be as small as 14KB so you can ship as often as you like without you or your users paying the bandwidth tax.
I think it's going to eat a piece of the Electron pie for Steam indie games.
Most stay with bun after seeing how fast and seamless it is to run typescript games with instant auto reload:
bun --watch game.ts
I think the most famous Electron game is Vampire Suvivors, but it has since been ported to Unity.
this is the first i'm hearing about games being built with electron / web tech too, let alone electrobun. i thought most game devs would just go for unity or godot
This is a lot of tradeoffs for saving 100 megs.
I understand that we should be good stewards of our customers’ hardware and not waste things unnecessarily, but also have to balance that with shipping something and not worrying about all the edge cases. Most people in developed countries have Internet connections of 100+ mbps, which means the app will still download in <10 seconds.
Does electrobun support using an embedded chromium for the renderer? I went to the project readme and it was really unclear if that’s a currently-supported option and if so, how to use it.
still:
> Optional CEF: bundle CEF (Chromium) when cross-platform consistency matters most.
from: https://blackboard.sh/electrobun/docs/guides/what-is-electro...
Taken from the product site (not this blog post) that was linked by another user. So you get to choose it would seem.
Electrobun sounds really cool, glad to see there's more work done to enable cool desktop apps without Electron.
My hope is this still acts like a library that multiple Tauri instances share. That would still have the upside of Tauri's shared library architecture (boo statically compiled programs, what a waste of precious ram!) while still letting us have a viable runtime. First app load might not be lightning fast but second app load is hopefully faster!! The OS webviews range from mediocre to absolute garbage; this to me would be a great improvement, that makes me happy!
In this case I don't know why I should use Tauri instead of Electron.
That's the whole point of my post: we get a relatively up to date Chrome and we get a shared library that all Tauri apps can share! Hence why I discussed why running n+1 apps should have lower overhead.
So it seems much much much better than Electron to me. Electron values the app developer, wants to give them assurances that the chromium is the exact specified chromium version, and bundles it. I get it, the world is complex and clamping down is a natural response, but this conservatism has given Electron its deservedly bad reputation, and Tauri's slightly shifted stance alleviates so much pain.
https://blackboard.sh/electrobun/docs/
It certainly looks clean enough, and I'm more familiar with zig than rust, so I might give it a shot.
Looks cool, I'll try this for my next personal desktop project and see how it goes
and then build with "notarize: true" in your config... and it pretty much just works
i've signed and notarized things with electrobun and it's perfectly fine. it also gives you escape hatches in case you're doing something more complicated
EDIT: in case i can help you with anything there, feel free to DM me! or join the electrobun discord. i'm very active there. (im not affiliated with EB. just know the struggle of apples notarization system)
Looks like I hit the submit button a bit too fast. I meant to say: "a short video comparing the startup times of apps using Electrobun, Tauri, Electron etc."
(I can't edit my comment anymore unfortunately.)
that said electrobun's author has published a bsdiff implementation in zig, and thats used for electrobun's updater. that means you download deltas, not the entire application bundle, every time you push an update to your users. and then it gets patched in-place.
this makes updates tiny, to the tune of a couple kB
* npx electrobun init
* [choose hello-world]
* bun install
* bun run build
This generates in linux a folder that takes about 60M [1] (mostly the "bun" executable)
[1] du says 60M, ls says 100M, maybe it is a sparse file ?
[1]: https://github.com/blackboardsh/electrobun/issues/4#issuecom...
I ended up having to use Ionic to create a html <-> Android app thing within github actions but Ionic doesn't support ad blocking abilities.
- views://mainview (33.7MB) <- your frontend is running here
- react-tailwind-vite-dev Networking (5.4MB)
- react-tail wind-vite-dev Graphics and Media (16.7MB)
- react-tailwind-vite-dev (60.7MB)
electrobun ships with an RPC (i think it also does some encryption?) so as long as you use that to communicate between your webview and bun "host process" you should be safe.
what kind of numbers are you looking for?