News

OpenCode Desktop Shifts to Electron for Enhanced Performance and Consistent Cross-Platform Experience

OpenCode Desktop Shifts to Electron for Enhanced Performance and Consistent Cross-Platform Experience

The OpenCode team recently announced the successful rebuild of OpenCode Desktop on Electron, with plans to soon cease releasing the Tauri version. This decision was carefully considered and is not indicative of one framework being inherently superior or faster, but rather Electron proving to be a better fit for OpenCode's specific use case.

To understand the rationale, it's essential to grasp how OpenCode operates. OpenCode utilizes a client-server model, with all components written in TypeScript. Clients, such as the Terminal User Interface (TUI) and Web User Interface (Web UI), communicate with a server. This server handles agent loop execution, interaction with Large Language Models (LLMs), and management of its SQLite database. The Web UI connects to servers over HTTP, thus requiring a running server, which users typically initiate by running opencode serve in a terminal. OpenCode Desktop was created to simplify this process, offering a straightforward app download and run experience.

Initially, Tauri was chosen as a lightweight wrapper for the Web UI and CLI. Upon startup, the bundled CLI would execute opencode serve, providing the Web UI with a local server connection. This approach enabled OpenCode to ship a compact, functional application that generally worked across various operating systems.

However, over time, several issues emerged. Primarily, Tauri's reliance on WebKit for rendering on macOS and Linux resulted in poorer performance compared to Chromium, alongside minor inconsistencies, particularly in styling. This directly impacted the team's ability to deliver a consistent cross-platform experience, with the reduced performance making daily use less pleasant. While Tauri has ongoing efforts to support Chromium via CEF, its stable availability remains uncertain.

The second challenge was running the bundled CLI, which negatively affected startup times and occasionally failed, despite efforts to mitigate issues, especially on Windows. While this wasn't a sole deciding factor, when combined with the team's desire to transition from Bun to Node for other reasons, the prospect of running the server code directly within Electron's built-in Node process became highly appealing.

Considering these challenges, the decision was made to migrate to Electron. Porting the UI was relatively straightforward, given its portable design and the utility of agents. Early Electron versions still bundled the CLI because the server code relied on Bun-specific APIs. Eventually, all Bun-specific APIs were removed, enabling the server to run directly within Node. This transition means that any plugins relying on Bun-specific APIs will not function in newer Desktop versions, with more details anticipated alongside OpenCode 2.0.

Currently, both Tauri and Electron versions of OpenCode Desktop are available. The Electron version will soon become the default for direct downloads and in-app updates on the beta channel, with a subsequent rollout to general releases.

↗ Read original source