Readit News logoReadit News
Posted by u/merlindru a month ago
Electrobun v1: Build fast, tiny, and cross-platform desktop apps with TypeScriptblackboard.sh/blog/electr...
I'm building a commercial macOS app with Electrobun [1]. I have previously written the same app with Tauri. I'll say that, while I love Tauri, using Electrobun has been an absolute breeze. I got the same app done in roughly 70% of the time [2]. It's a very productive stack. In no small part due to Electrobun, but also the fact that Bun has tons of DX niceties and a builtin bundler.

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 · a month ago
Hey HN, Electrobun creator here. Thanks for posting this.

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 · 23 days ago
Are the types up to date with the docs? For example, when using BrowserWindow I get typescript errors if trying to pass an object with the key "partition".
merlindru · a month ago
thank you for building electrobun!!
maddada · a month ago
Looks very promising, will be building my next project with it. Full TS stack is where I'm most productive. I'm glad we now have a more performant and lean alternative to Electron while not needing to deal with Rust and long compilation steps.
seebeen · a month ago
Just finished my first tauri app. Was suprised at long windows build took. I'll defo give this a go
bicepjai · 25 days ago
Is it during development builds or release build ?
hu3 · a month ago
I see a lot of game devs in discord experimenting with Electrobun to release desktop games.

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 · a month ago
I do a lot of web development, and even if we set the great tooling aside for a moment, Bun is still a major improvement (a real leap, I’d say) when it comes to performance.
GCUMstlyHarmls · a month ago
Are many games built with Electron ...? I know there are a few HTML5 games, crosscode was the first one I recall seeing that really pushed it. Aren't most small games Unity or Godot?
hopfog · a month ago
CrossCode is a marvel in that they had to build their own runtime: https://news.ycombinator.com/item?id=41155807

I think the most famous Electron game is Vampire Suvivors, but it has since been ported to Unity.

hopfog · a month ago
What Discord server are you referring to? Would love to join.
merlindru · a month ago
also wondering about this. it sure isn't in electrobuns own discord server. i'm in that one and its mostly Q&A (with Yoav doing most of the answering and a couple people like me doing most of the questioning, ha)

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

jazzypants · 25 days ago
node has watch mode and runs TypeScript files now too.
lukevp · a month ago
One of the main problems I see with tauri is that system web views just aren’t a great solution for a ui framework. Partly because Linux doesn’t have an official webview implementation, partly because the web views across OS versions have differences (eg. Tauri on Linux had a benchmark saying the boot time was 20+ seconds because of the webview, and win 7 and I think even early versions of win 10 do not use the edge webview).

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 · a month ago
> Instead of distributing Chromium, By default Electrobun uses your system's native WebView (WebKit on macOS, Edge WebView2 on Windows, WebKitGTK on Linux).

still:

> Optional CEF: bundle CEF (Chromium) when cross-platform consistency matters most.

from: https://blackboard.sh/electrobun/docs/guides/what-is-electro...

onimishra · a month ago
“System's native webview as renderer, CEF Optional”

Taken from the product site (not this blog post) that was linked by another user. So you get to choose it would seem.

kzahel · a month ago
On Windows I noticed for my Tauri app I had to use this https://v2.tauri.app/distribute/windows-installer/#embedded-... (https://github.com/kzahel/jstorrent/commit/10cc1c53#diff-f61...) even on a new windows 11 install for the webview to work, but my app seems to work fine otherwise on all platforms (I only tested Ubuntu desktop though, ha).

Electrobun sounds really cool, glad to see there's more work done to enable cool desktop apps without Electron.

Bolwin · a month ago
Why don't any of the major distros have a webview? Seems an obvious move if you want apps and alongside user experience, apps are the biggest barrier to linux adoption
austinjp · a month ago
There may not be an official webview, but all (?) major distributions have libwebkit2gtk, which is used by Wails (Go) and Tauri (rust). So it's a de facto standard if not official.

https://webkitgtk.org/

https://wails.io/docs/gettingstarted/installation/

https://v2.tauri.app/start/prerequisites/

jauntywundrkind · a month ago
There is a ton of work going into a Tauri based on CEF. https://github.com/tauri-apps/tauri/tree/feat/cef

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!

Ikryanov · a month ago
A Tauri app built on CEF (Chromium) is very similar to Electron (which also uses Chromium). The key difference is that Tauri uses Rust for the application’s business logic, whereas Electron uses JavaScript.

In this case I don't know why I should use Tauri instead of Electron.

Alifatisk · a month ago
Title should maybe specify that this is a blogpost from the author reflecting over the project. There’s better link to showcase the actual project https://blackboard.sh/electrobun/docs
zdragnar · a month ago
Neat! Here's the project main page for those interested in more than the release announcement:

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 · a month ago
I'm going to production with a new Electron app at my job this week, i wish this had existed a year ago lol. Electron Builder does a pretty good job making the updates and signatures not TOO painful but it hasn't been painless by any stretch.

Looks cool, I'll try this for my next personal desktop project and see how it goes

xrd · a month ago
The article mentioned notarizing and stapling as problems with prior frameworks. What's the story here? If you don't use xcode as your ide (and I don't see that this project management is happening inside xcode), Apple makes that stuff really hard. And windows is easier but still hard to automate in CI. If this framework offers better solutions I'm all ears.
merlindru · a month ago
most use cases are supported out of the box. you just have to set a few env vars

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)

xrd · a month ago
Thanks, that's great! Very generous.