gitmyhub

electrobun

TypeScript ★ 12k updated 7d ago

Build ultra fast, tiny, and cross-platform desktop apps with Typescript.

A TypeScript framework for building desktop apps using the Bun runtime and a built-in system webview, covering everything from project creation to packaging and shipping tiny binary-patch updates.

TypeScriptBunWebViewWGPUThree.jsBabylon.jssetup: easycomplexity 3/5

Electrobun is a framework for building desktop applications using TypeScript. It covers the full lifecycle: writing the app, packaging it for distribution, and shipping updates to users. The goal described in the README is to go from starting a new project to having something distributable in under fifteen minutes.

Under the hood it uses Bun, a fast JavaScript runtime, to run your application's main process. The user interface is displayed through a webview, which is a browser component built into the operating system, so the app does not need to bundle a full browser to show web-based UI. This keeps the packaged app size small, around 14MB when using the system webview. If you prefer a consistent browser across all platforms, you can optionally bundle Chromium instead, which increases the size to around 16MB. App updates are delivered as binary patches that only describe what changed between versions, so updates can be as small as 4KB rather than a full re-download.

The main process and the webview run in separate isolated processes and communicate through a typed RPC system. You define the messages each side can send and receive, and the library handles passing data between the two processes safely.

For cases where a webview is not suitable, Electrobun also supports WGPU, which gives you direct access to the GPU from Bun TypeScript code. This lets you render graphics on a native GPU surface instead of inside a browser. The README also mentions adapters for Three.js and Babylon.js that work in this mode.

You start a new project by running npx electrobun init. The README includes a list of community apps built with Electrobun, ranging from note-taking tools and audio players to Git clients and AI coding assistants.

Where it fits