electrobun README

The project's README from github.com/blackboardsh/electrobun. As one markdown file: README.md.

Logo

Electrobun

Get started with a template
hutch electrobun init

What is Electrobun?

Electrobun aims to be a complete solution-in-a-box for building, updating, and shipping fast, compact, cross-platform desktop applications written in TypeScript. Hutch is the native build and workspace CLI. Cottontail is Electrobun's JSC-based default JavaScript runtime. Electrobun's platform layer combines Zig, Objective-C, and C++.

Visit https://framework.blackboard.sh/electrobun/ to see api documentation, guides, and more.

Install Hutch globally, then use it to create and build a project. Published templates include the exact Electrobun release they were tested with. In a hand-written project that pin is optional; without one, Hutch uses an npm-supplied paired default or floats on the active release channel. Hutch verifies and installs the resolved release's platform archive under ~/.hutch/releases/electrobun and copies its SDKs into the project's generated .hutch/devkit sysroot:

curl -fsSL https://hutch.blackboard.sh/hutch/install.sh | sh
hutch electrobun init

Initialization requires network access to fetch the current template catalog and selected template. Later builds can reuse exact releases and managed toolchains that are already installed.

Or bootstrap the same interactive initializer from npm or Bun. The single, dependency-free npm package downloads the exact paired Hutch archive from that version's Electrobun GitHub Release when needed, verifies and caches it, and forwards the command. The initializer also ensures a compatible global launcher for the generated project's hutch tasks. It does not carry or own the Electrobun runtime or SDKs:

npx electrobun init
# or
bunx electrobun init

Hutch's built-in npm-compatible resolver installs JavaScript dependencies by default and writes hutch.lock; hutch pm exec runs project-local package binaries. A project's hutch.config.ts may instead select npm, Bun, pnpm, Yarn, or a custom executable, and Hutch delegates package operations to that explicit choice. Package management is independent of whether the app's main process runs on Cottontail or Bun.

Don't miss our:

Project Goals

Apps Built with Electrobun

Video Demos

Audio TTS Demo

Co(lab) Demo

DOOM Demo

Star History

Electrobun star history four weeks after the v1 launch
star history 4 weeks after v1 launch

Contributing

Electrobun is one piece of a vision I'm building. I'm optimizing for focus and execution. Issues and PRs can be used to share ideas, but there should be no expectation that I will review, respond to, or merge them.

Ways to get involved:

Development Setup

Building apps with Electrobun is as easy as installing Hutch and running hutch electrobun init.

This section is for building Electrobun from source locally in order to contribute fixes to it.

Prerequisites

Install Hutch globally before building Electrobun:

curl -fsSL https://hutch.blackboard.sh/hutch/install.sh | sh

On Windows PowerShell:

& ([scriptblock]::Create((irm https://hutch.blackboard.sh/hutch/install.ps1)))

macOS:

Windows:

Linux:

On Ubuntu/Debian based distros: sudo apt install build-essential cmake pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev libpipewire-0.3-dev librsvg2-dev

Linux applications also require the corresponding GTK 3, WebKitGTK 4.1, Ayatana AppIndicator, and librsvg runtime packages on end-user systems. See the cross-platform development guide for distro-specific install commands. The launcher reports the exact missing shared library when these dependencies are unavailable. Wayland screen-region capture additionally requires a working desktop portal, PipeWire, and the libpipewire-0.3.so.0 runtime library (provided by libpipewire-0.3-0, or libpipewire-0.3-0t64 on newer Ubuntu/Debian releases).

First-time Setup

git clone --recurse-submodules https://github.com/blackboardsh/electrobun.git
cd electrobun/package
npm ci
hutch dev:clean

Development Workflow

# All commands are run from the /package directory
cd electrobun/package

# After making changes to source code
hutch dev

# Exercise one repository template against the same local package/dist
hutch dev:template hello-world

# If you need a completely fresh start
hutch dev:clean

hutch dev builds package/dist and runs Kitchen against that local Electrobun devkit. Running hutch dev directly from kitchen/ continues to use the Electrobun version pinned in kitchen/hutch.config.ts.

hutch dev:template <template-name> builds the same local devkit, runs the template's configured dependency installation, and starts its dev task against those local bytes. Repository templates stay unpinned for this workflow; the release publisher injects the shipped Electrobun version into each staged template archive.

The native build generates package/src/native/compile_flags.txt from the compiler flags resolved for the current machine. clangd-compatible editors discover it automatically; rerun the build after changing native dependencies or system toolchains.

With sibling jsc, cottontail, dash-cloud, and electrobun checkouts, use --local to additionally build and select the local JSC, Cottontail, and Hutch layers:

hutch dev --local

The first Hutch is globally installed. Stack preparation explicitly selects the completed local Hutch engine and Cottontail build for the remainder of the command.

Additional Commands

All commands are run from the /package directory:

Debugging

macOS: Use lldb <path-to-bundle>/Contents/MacOS/launcher and then run to debug release builds

Platform Support

OS Status
macOS 14+ Official
Windows 11+ Official
Ubuntu 24.04+ Official
Other Linux distros (gtk3, webkit2gtk-4.1) Community
Raspberry Pi Unofficial fork: kortexa-ai/electrobun (linux-wpe) — follow the author @francip

electrobun (blackboardsh/electrobun)

Searching Database…

这是什么?Electrobun 是一个框架,用于构建快速、体积小、跨平台的桌面应用。它完全使用 TypeScript 编写,并自带打包构建工具、运行时和原生平台层。
它基本上就是 Electron,还是从零开始做的?它是一个独立的框架,而不是 Electron 的封装。它不捆绑 Node 和 Chromium,而是使用自研的基于 JSC 的 JavaScript 运行时 Cottontail,外加用 Zig、Objective-C 和 C++ 编写的原生平台层。
怎样开始一个新项目?先安装 Hutch(Electrobun 的原生构建和工作区命令行工具),然后使用 'electrobun init' 生成一个模板。
它用什么运行时代替 Node 和 Chromium?它内置 Cottontail,这是 Electrobun 自己基于 JSC(JavaScriptCore)的默认 JavaScript 运行时,通过 Hutch 命令行工具进行构建和工作区管理。
每个操作系统的支持都同样可靠吗?官方只支持 macOS 14+、Windows 11+ 和 Ubuntu 24.04+;其他 Linux 发行版(gtk3、webkit2gtk-4.1)由社区维护,树莓派只能通过非官方分支使用。
什么是 Hutch?Hutch 是 Electrobun 的原生构建和工作区命令行工具,用于生成项目、运行开发版构建以及编译发布包。
它在保持应用体积小、更新快方面有什么不同做法?使用系统 webview 时,它力求生成体积小的自解压应用包;更新时优先使用二进制补丁,只有无法使用补丁时才回退到完整的压缩包下载。
我能直接使用 WebGPU 或 3D 库吗?可以。Electrobun 提供 WGPU 接口,可以在不使用 webview 的情况下直接控制原生 GPU 绘图区域;它还内置 Three.js 和 Babylon.js 适配器,可直接在 Cottontail 主进程中运行。
人们真的用它做过哪些应用?社区项目包括 PDF/DOCX 编辑器、Git 客户端、面向 AI 的密码管理器、Markdown 编辑器、漫画阅读器,甚至还有 DOOM 移植版,此外还有几十种其他桌面工具。
Size
151.1 MB
Stars
12.9K
Age
2y
Commits · 90 Days