Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Frontend Development
4 min read

OpenCode Replaces Electron with Rust: 10-100x Speedup, Native GPU, Browser via WebGPU

OpenCode's new opencode-rune repository rewrites its desktop client in Rust using the custom GPU framework Rune, eliminating Electron and Chromium for 10-100x performance gains, native Metal/DX12/Vulkan rendering, WebGPU browser support, on-demand CEF sidecar, Ghostty terminal integration, and Luau for hot-reloadable UI plugins.

OpenCode Replaces Electron with Rust and Custom GPU Framework

OpenCode recently open-sourced the opencode-rune repository, rewriting its desktop client and embeddable session components in Rust. The resident service and CLI, which migrated back to Node.js from Bun in July, remain unchanged.

Dropping Electron, DOM, and Chromium for Native GPU Rendering

The new client eliminates Electron, the DOM, and the Chromium process at startup. It is built from scratch in Rust on top of the team's custom GPU framework Rune (open-sourced in late October). OpenCode claims the new desktop app is 10 to 100 times faster and lighter than the previous Electron version. It runs natively on Windows, macOS, and Linux via Metal, DirectX 12, and Vulkan respectively, and the same codebase can be compiled to wasm32 to run in browsers through WebGPU.

OpenCode Rust crab kicking Electron atom logo
OpenCode Rust crab kicking Electron atom logo

Browser Kernel as On-Demand CEF Sidecar

AI programming tools typically spawn multiple Chromium processes at launch. opencode-rune removes the browser kernel from startup. An embedded browser panel is retained but split into a separate CEF sidecar process. When the user is only chatting with the agent or viewing diffs, no Chromium runs. The sidecar is fetched only when the user triggers the built-in browser via a shortcut.

Native Components for Performance-Critical Features

Other heavy components are replaced with native alternatives. The terminal integrates Ghostty's libghostty-vt directly, avoiding web-based terminal libraries. Text rendering uses Windfoil to compute coverage from vector outlines on the GPU, ensuring sharp scaling and dragging. Code previews, split diffs, and vector flowcharts in conversations are all drawn natively on the GPU.

OpenCode (Rune) UI showing native vector flowchart and split code diff
OpenCode (Rune) UI showing native vector flowchart and split code diff
OpenCode (Rune) sidebar session list with integrated Ghostty-VT terminal panel
OpenCode (Rune) sidebar session list with integrated Ghostty-VT terminal panel

Luau for Hot-Reloadable UI Plugins

Writing UI in Rust requires recompilation for minor tweaks. Instead of layering JavaScript or TypeScript, the team chose Luau — a statically typed Lua variant used by Roblox. According to ARCHITECTURE.md, panels, dialogs, and commands live in the plugins/ directory. Local development with the --plugin-hot flag enables instant hot-reload without touching the Rust compiler. Performance-critical features like the file tree, global search, and voice input reside in zero-dependency Rust features/ modules. The lower-level session-view is even extracted as a standalone library for embedding in other Rune applications.

Luau's lightweight VM, designed for high-frequency game scripting, compiles to bytecode embedded in the binary, keeping bundle size and startup time low while enabling fast hot updates.

Rune: A UI Framework Designed Around AI Agents

Instead of adopting Tauri or existing Rust GUI frameworks, Anomaly built Rune (now at 8.9k GitHub stars, 95.9% Rust). Rune is designed from day one for AI agent workflows. Every Rune application can run headless — without a display or browser. After an AI coding tool modifies code, it can render the UI to PNG, export the full element tree, and simulate clicks and inputs via scripts to verify layout and button functionality automatically.

This philosophy extends to contribution guidelines: the Rune repository discourages traditional pull requests, suggesting users have their own agents file issues describing problems or ideas, which the maintainers' agents then address quickly.

Rune GitHub repository homepage, 8.9k stars, 95.9% Rust code
Rune GitHub repository homepage, 8.9k stars, 95.9% Rust code

Running the Project Locally

To connect to an existing OpenCode service, the repository provides the launch command: cargo run -p opencode-desktop -- --live The default branch is dev, and the official site currently offers only dev preview builds for each platform. A full release build consumes about 10 GB of memory and takes 25–60 minutes. The project lacks traditional automated tests; daily changes are validated by running the app and observing results, supplemented by scripts that enforce architectural boundaries.

References

[1] opencode-rune: https://github.com/anomalyco/opencode-rune [2] Rune:

https://github.com/anomalyco/rune

For attribution, corrections or content rights, contactadmin@besthub.dev

Report an issue with this article

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion