Electrobun is in the very early stages. The roadmap is a bit out of date. Here are some highlights:
- it’s like Tauri in that it uses the system webview and does not bundle chromium
- it’s like Electron in that it bundles Bun instead of Node for the main process so you just write typescript for both the main and browser contexts
- native bindings written in c/objc with a zig wrapper that the bun process runs
- it will be cross platform, but working on stability first
- the cli handles updates code signing and everything else you need and outputs build artifacts that you just need to upload to S3 or any static file host.
- it has a custom optimized bsdiff implementation in zig that autogenerates updates for your app as small as 4KB
- it has a custom zig self extracting mechanism that uses zstd so your initial download is also as small as can be.
- it has a custom encrypted easy to use RPC mechanism between bun and browser processes where you just write method signatures and handlers.
- it has a custom OOPIF implementation so you can embed isolated browser contexts with your html <electrobun-webview> element that are performant and easy to use so you could build a multi tab web browser with it if you wanted.
So this aspires to be something like Tauri, but with Zig for the fast/native bits, and leaning harder on and more opinionated about the frontend/UI part?
That's a pretty interesting proposal, but also a staggeringly huge amount of work.
This is awesome! I built a similar tool as an experiment while at Recurse: https://github.com/zephraph/webview. Didn’t really do any heavy lifting though, just reused some of Tauri’s crates. Does Bun run on the same process as the GUI binding? OSX steals the main thread when rendering a native window which made me lean towards separating the processes. Still wonder if there’s a better way.
I’m using bun for the main process. Bun runs a zig binary which can call objc/c methods. So the “main native application thread” is technically the zig process.
Then there’s all kinds of fancy rpc between bun and zig and between bun and browser contexts.
I dug through it a tiny bit because I was curious as well. To me it looks like OS-specifics aren't dealt with in the project. It uses bun to run the TypeScript. From the getting started docs the project just opens a browser window for the UI. I didn't look to see if this meant the user's default browser or a bundled browser.
Tangential but I hadn't heard of Bun before and their performance claims had me interested, sadly seems you just can't beat V8 in the real world. I threw some poorly optimized art code I wrote yesterday at it and it's almost 2x as slow as when I run the same code in node.
Most of the speed ups seem to be in optimizations to the native code and porting js libraries to it. I'd expect pure javascript code to not have much of a difference. 2x sounds like you hit some limitations of JavaScriptCore itself.
For relly lightweight cross-platform desktop apps better use a non-webview-based native framework like Qt, GTK, wxWidgets or even recently released FLTK 1.4.
Modern apps these days often end up needing to render complex layouts and rich text, so you end up needing QWebview anyway. At least that's been my experience creating desktop apps lately.
One of my favorite things about Tauri is that I can write all the "back end" code in Rust. I think this has a lot of advantages for performance and correctness. For that reason alone I'm more inclined to reach for it than Electron or something like this when I have options.
As an alternative to electron, using bun as a base sounds nice. But being better than electron is a low bar when it's the source of the laziest, most bloated programs on my system.
Also, still waiting for bun to work on freebsd. Patiently! But it's on my xmas wishlist :)
Electron is not a rendering engine. It’s an application bundler, which itself bundles Chromium and NodeJS.
This project uses native web views, like Tauri. They wrote that they might provide the option of bundling your own engine, ie like Electron, which I personally think it’s a bad idea. Tauri proved that you don’t need it.
But now that you mention it, agreed that 50MB is a lot.. maybe just standard JS dep bloat? That could be clarified.
>Security and Performance with isolation between the main and webview processes
That's one of the performance characteristics I'm afraid will hinder certain applications.
It sounds like you need to use a IPC bridge to share data between the main process and renderor. Which means copying all the shared data. Like if I wanted to use ffmpeg for decoding video then each frame I'm waiting for a the decoded image to be copied before rendering it.
Originally I had it going via browser -> postmessage -> zig -> bun via named pipes and then bun -> zig via named pipe -> js via evaluate js.
I’m building https://colab.sh/ with electrobun and that rpc was pretty slow when trying to load multi MB files in the code editor.
Last week I added an encrypted socket rpc option directly between bun and browser.
Loading a 2MB file went from a few seconds to 400ms.
I made it so that in contexts where CORS allows it automatically upgrades to the socket based faster RPC.
That’s via RPC though. electrobun also exposes a custom views:// scheme in the browser context that can load files directly from specific sandboxed places in the file system. More to improve there but for a very big file you’d be better off writing it to the file system that would be much faster.
Developing for Electron you usually had a regular webpack server in the background to handle hot-reload cases and technically you could have a regular browser.
In production however you don't want a browser for 2 reasons, first should a local app really expose internals to the network(And get mucked up by firewalls)? secondly the deployment is easier the more it's self-contained.
Also since there are internal communication channels between "browser" and native/"server" parts (that are far faster than going over the network) you don't want to diverge the production and development environment to avoid having hard to debug things.
On top of it, in this case bun is also a bundler so you get the typescript transpilation for free.
So to summarize, if your app is really only a plain webapp distributed to desktop then sure you can developer everything with a local webserver and package with whatever is available, but as soon as you involve native off-browser parts you don't want to start exposing everything and using the embedding systems(be it electron or webview2/khtml,etc) built in browser<->native communication is simply the saner choice and the point of these projects is to abstract that from the developer.
Sciter is an HTML/CSS/JS engine with the ability to attach native widgets to DOM elements. So you'll benefit from two worlds: HTML/CSS layout richness and native widgets.
The major problem though is Linux family of OSes in this respect. I have version of Sciter that works directly on X11 or Wayland ( https://sciter.com/sciter-glx-generation-4/ ). Windows and MacOS have clear concept of child windows/widgets but no such things on X11 or Wayland realistically speaking.
So react-native is practically iOS/Android only thing.
[+] [-] yoav|1 year ago|reply
Thanks to whoever submitted.
Electrobun is in the very early stages. The roadmap is a bit out of date. Here are some highlights:
- it’s like Tauri in that it uses the system webview and does not bundle chromium
- it’s like Electron in that it bundles Bun instead of Node for the main process so you just write typescript for both the main and browser contexts
- native bindings written in c/objc with a zig wrapper that the bun process runs
- it will be cross platform, but working on stability first
- the cli handles updates code signing and everything else you need and outputs build artifacts that you just need to upload to S3 or any static file host.
- it has a custom optimized bsdiff implementation in zig that autogenerates updates for your app as small as 4KB
- it has a custom zig self extracting mechanism that uses zstd so your initial download is also as small as can be.
- it has a custom encrypted easy to use RPC mechanism between bun and browser processes where you just write method signatures and handlers.
- it has a custom OOPIF implementation so you can embed isolated browser contexts with your html <electrobun-webview> element that are performant and easy to use so you could build a multi tab web browser with it if you wanted.
[+] [-] chalst|1 year ago|reply
That would be https://news.ycombinator.com/user?id=CharlesW aka Charles Wiltgen.
[+] [-] pmuk|1 year ago|reply
[+] [-] jacobgorm|1 year ago|reply
[+] [-] bsimpson|1 year ago|reply
[deleted]
[+] [-] veidr|1 year ago|reply
That's a pretty interesting proposal, but also a staggeringly huge amount of work.
[+] [-] yoav|1 year ago|reply
I’m only picking up steam though and my whole career has been taking on these kinds of huge projects so it’s just getting started.
[+] [-] zephraph|1 year ago|reply
[+] [-] yoav|1 year ago|reply
Then there’s all kinds of fancy rpc between bun and zig and between bun and browser contexts.
[+] [-] sshine|1 year ago|reply
[+] [-] c0wb0yc0d3r|1 year ago|reply
[+] [-] semireg|1 year ago|reply
[+] [-] thot_experiment|1 year ago|reply
[+] [-] hiccuphippo|1 year ago|reply
[+] [-] niutech|1 year ago|reply
For relly lightweight cross-platform desktop apps better use a non-webview-based native framework like Qt, GTK, wxWidgets or even recently released FLTK 1.4.
[+] [-] yayoohooyahoo|1 year ago|reply
[+] [-] rubymamis|1 year ago|reply
[+] [-] cageface|1 year ago|reply
[+] [-] barbequeer|1 year ago|reply
[+] [-] bitsandboots|1 year ago|reply
Also, still waiting for bun to work on freebsd. Patiently! But it's on my xmas wishlist :)
[+] [-] schneehertz|1 year ago|reply
[+] [-] rounce|1 year ago|reply
[+] [-] yard2010|1 year ago|reply
[+] [-] ivanjermakov|1 year ago|reply
> The current Electrobun Playground app is 50.4MB in size (most of this is the bun runtime)
Seems to be more than just bun runtime.
[+] [-] klabb3|1 year ago|reply
This project uses native web views, like Tauri. They wrote that they might provide the option of bundling your own engine, ie like Electron, which I personally think it’s a bad idea. Tauri proved that you don’t need it.
But now that you mention it, agreed that 50MB is a lot.. maybe just standard JS dep bloat? That could be clarified.
[+] [-] bobajeff|1 year ago|reply
That's one of the performance characteristics I'm afraid will hinder certain applications.
It sounds like you need to use a IPC bridge to share data between the main process and renderor. Which means copying all the shared data. Like if I wanted to use ffmpeg for decoding video then each frame I'm waiting for a the decoded image to be copied before rendering it.
[+] [-] yoav|1 year ago|reply
I’m building https://colab.sh/ with electrobun and that rpc was pretty slow when trying to load multi MB files in the code editor.
Last week I added an encrypted socket rpc option directly between bun and browser.
Loading a 2MB file went from a few seconds to 400ms.
I made it so that in contexts where CORS allows it automatically upgrades to the socket based faster RPC.
That’s via RPC though. electrobun also exposes a custom views:// scheme in the browser context that can load files directly from specific sandboxed places in the file system. More to improve there but for a very big file you’d be better off writing it to the file system that would be much faster.
[+] [-] afavour|1 year ago|reply
[+] [-] AlfredBarnes|1 year ago|reply
[+] [-] unknown|1 year ago|reply
[deleted]
[+] [-] dboreham|1 year ago|reply
[+] [-] whizzter|1 year ago|reply
In production however you don't want a browser for 2 reasons, first should a local app really expose internals to the network(And get mucked up by firewalls)? secondly the deployment is easier the more it's self-contained.
Also since there are internal communication channels between "browser" and native/"server" parts (that are far faster than going over the network) you don't want to diverge the production and development environment to avoid having hard to debug things.
On top of it, in this case bun is also a bundler so you get the typescript transpilation for free.
So to summarize, if your app is really only a plain webapp distributed to desktop then sure you can developer everything with a local webserver and package with whatever is available, but as soon as you involve native off-browser parts you don't want to start exposing everything and using the embedding systems(be it electron or webview2/khtml,etc) built in browser<->native communication is simply the saner choice and the point of these projects is to abstract that from the developer.
[+] [-] dymk|1 year ago|reply
[+] [-] PittleyDunkin|1 year ago|reply
[+] [-] c-smile|1 year ago|reply
Sciter is an HTML/CSS/JS engine with the ability to attach native widgets to DOM elements. So you'll benefit from two worlds: HTML/CSS layout richness and native widgets.
The major problem though is Linux family of OSes in this respect. I have version of Sciter that works directly on X11 or Wayland ( https://sciter.com/sciter-glx-generation-4/ ). Windows and MacOS have clear concept of child windows/widgets but no such things on X11 or Wayland realistically speaking.
So react-native is practically iOS/Android only thing.
[+] [-] surfmike|1 year ago|reply
[+] [-] golanggeek|1 year ago|reply
[+] [-] jrop|1 year ago|reply
[+] [-] jedisct1|1 year ago|reply