Electrobun v1: Build fast, tiny, and cross-platform desktop apps with TypeScript
171 points| merlindru | 11 days ago |blackboard.sh
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 :)
yoav|10 days ago
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.
sureglymop|8 days ago
merlindru|10 days ago
maddada|21 days ago
seebeen|10 days ago
hu3|11 days ago
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
egeozcan|11 days ago
GCUMstlyHarmls|11 days ago
hopfog|11 days ago
jazzypants|10 days ago
lukevp|11 days ago
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.
lgvld|11 days ago
still:
> Optional CEF: bundle CEF (Chromium) when cross-platform consistency matters most.
from: https://blackboard.sh/electrobun/docs/guides/what-is-electro...
onimishra|11 days ago
Taken from the product site (not this blog post) that was linked by another user. So you get to choose it would seem.
kzahel|11 days ago
Electrobun sounds really cool, glad to see there's more work done to enable cool desktop apps without Electron.
Bolwin|11 days ago
jauntywundrkind|11 days ago
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!
Alifatisk|11 days ago
zdragnar|11 days ago
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.
queenkjuul|11 days ago
Looks cool, I'll try this for my next personal desktop project and see how it goes
xrd|10 days ago
merlindru|10 days ago
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)
rubymamis|11 days ago
Ikryanov|11 days ago
nine_k|11 days ago
sumolessons|11 days ago
[1]: https://github.com/oven-sh/bun/issues/21237
ugouwakwe|5 days ago
codethief|11 days ago
codethief|10 days ago
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.)
InfiniteLoopGuy|11 days ago
merlindru|11 days ago
moogly|8 days ago
[1]: https://github.com/blackboardsh/electrobun/issues/4#issuecom...
chrisco255|11 days ago
merlindru|10 days ago
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
mrighele|10 days ago
* 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 ?
Imustaskforhelp|11 days ago
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.
merlindru|10 days ago
synergy20|11 days ago
perpil|11 days ago
skybrian|11 days ago
Ikryanov|11 days ago
- 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)
merlindru|10 days ago
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.
hwisnu_bearblog|10 days ago
phplovesong|11 days ago
merlindru|10 days ago
what kind of numbers are you looking for?
unknown|11 days ago
[deleted]
jit-it|10 days ago
Jgoauh|10 days ago
unknown|21 days ago
[deleted]
KingOfCoders|11 days ago