Electrobun v1:使用 TypeScript 构建快速、微小且跨平台的桌面应用程序。
Electrobun v1: Build fast, tiny, and cross-platform desktop apps with TypeScript

原始链接: https://blackboard.sh/blog/electrobun-v1/

Electrobun 是一个使用 TypeScript 构建的新桌面应用框架,旨在解决作者在使用 Electron 和 Tauri 等现有解决方案时遇到的问题。在多年构建 Web 规模应用之后,创建者希望回归桌面应用开发的“黄金时代”,发现当前工具对于持续交付和更新来说过于繁琐。 Electrobun 专注于速度、小型打包尺寸和跨平台兼容性(macOS、Windows、Ubuntu)。它自动化安装包创建、自动更新(使用 Zig 优化的差异补丁系统),并利用 Bun 的 FFI 以提高效率。 该框架提供全面的功能——窗口控制、菜单、webview 以及强大的工具——旨在提供卓越的“进程外 iframe”(OOPIF)体验。作者已经使用 Electrobun 重写了他们的项目 co(lab),现在专注于发展社区并支持开发者构建雄心勃勃的桌面应用程序。

Electrobun 是一个用于使用 TypeScript 和 Bun 构建快速、小型且跨平台桌面应用程序的新框架。一位开发者报告称,使用 Electrobun 完成 macOS 应用程序的时间比使用 Tauri 缩短了 70%,赞扬了它的生产力和清晰的 API。 主要特性包括使用类型化 RPC 轻松操作 webview,内置打包、代码签名和公证功能。开发通过单个命令实现热模块替换 (HMR),并且控制台日志直接输出到终端。Electrobun 还拥有一个高效的更新机制,使用 BSDiff 和 Zig,从而实现小的更新尺寸。 早期采用者,包括游戏开发者,正在尝试将 Electrobun 作为 Electron 的潜在替代方案,尤其是在独立游戏开发方面。 许多评论者对它专注于 TypeScript 以及与 Electron 和 Tauri 相比更精简的方法表示兴奋。
相关文章

原文

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

Two years ago I paused co(lab) to build the desktop app framework I wished existed. Now that I've shipped a stable v1, this post is me reflecting on this two-year sidequest that had me learning Zig, C, C++, and Objective-C.

Why I Built This

My intro to programming was Visual Basic 6 in the early 2000s, building desktop apps. Then Adobe AIR changed my life—I built a few startups and shipped desktop apps to thousands of people. That was the golden age for me. Fast forward 20+ years of zero-to-one work at startups, building and scaling key systems as early eng at unicorns shipping to 10s of millions, and starting my own startup lab; somehow desktop development had gotten worse. I was building co(lab), a hybrid web browser + code editor + PTY terminal, and I just ran into one papercut too many.

The first version was built in Electron. The DX was rough—figuring out code signing, notarization, distribution, and updates felt like fighting the framework instead of building my app. I wanted to ship like the web, continuously, but every piece of the toolchain made that harder than it needed to be.

I tried Tauri but Rust is not for everyone. Bun was up and coming, still months away from 1.0. So I got to work.

From macOS to Everywhere

When Electrobun started, it only built macOS apps. Today it has first-class support for building on and distributing to macOS, Windows, and Ubuntu. Installers, auto-update artifacts, differential patches—all generated automatically. Bring your own static host (R2, S3, GitHub Releases) and you're done. The differential updates are powered by zig-bsdiff, which I ported from C to Zig and optimized with SIMD and zstd.

As Bun's FFI stabilized, I replaced most of the Zig FFI layer I'd written and leaned on Bun directly. The architecture inverted in a good way—Bun uses shared memory when spinning up workers, so Electrobun stays efficient even with multiple processes.

What Shipped

Electrobun today is a complete framework: cross-platform window controls, menus, accelerators, global shortcuts, clipboard, dialogs, webview partitions, session storage, find-in-page, and solid tooling around bundling and updates.

The OOPIF story is real now. Electron's <webview> tag was deprecated from Chromium and they still haven't fixed it. Building a Better OOPIF goes deep on how <electrobun-webview> evolved into a true "super iframe"—DOM positioning, process isolation, layering that actually works, and no cursor flicker nightmares. It works across platforms without patching browser engines.

What's Next

co(lab) is fully rewritten on Electrobun and I'm doubling down on it now that v1 is real. The framework is stable enough to build ambitious, long-lived products without worrying about platform churn. That was always the goal.

The community is growing. People in our Discord are building insanely cool apps. If you've tested betas, filed issues, or sent feedback—thank you. Electrobun is the first major thing I'm shipping from Blackboard, and you helped shape it.

联系我们 contact @ memedata.com