Shirei: A Cross-Platform Native Go GUI Framework

Shirei: A Cross-Platform Native Go GUI Framework

Overview of Shirei

Shirei is a cross-platform GUI framework written in native Go, designed to provide a streamlined way to build desktop applications. Its primary architectural goal is to minimize reliance on C libraries (cgo) while maintaining native performance across different operating systems.

Technical Architecture and Platform Backends

Shirei employs platform-specific strategies to handle windowing and rendering, avoiding a "one size fits all" C-wrapper approach.

  • Windows: The framework loads relevant DLLs manually and invokes them, leveraging the stability of the Windows DLL interface to avoid cgo.
  • Linux: Shirei implements X11 and Wayland wire protocols directly in Go, which simplifies cross-compilation and distribution.
  • macOS: The framework utilizes cgo to access Cocoa libraries, as macOS typically requires system name resolution and does not favor statically linked Go programs.

Because the backends rely on an RGBA buffer as the lowest common denominator, the framework currently bypasses native OS accessibility features.

Immediate Mode API Design

Shirei is built on an immediate mode API, which allows developers to describe the UI based on current data every frame rather than maintaining and syncing the state of persistent UI widgets.

Immediate Mode vs. Retained Mode

While the framework promotes the efficiency of not having to sync data with widget state, community discussion highlights a common debate regarding scalability. Some developers argue that immediate mode APIs may not scale to highly complex user interfaces compared to retained mode systems. There is also a distinction made between immediate mode rendering (redrawing every frame) and unidirectional data flow (as seen in React), with some noting that the framework's documentation may conflate these concepts.

Current Limitations and Roadmap

Shirei is currently positioned as a tool for developer tooling rather than polished consumer applications. The following limitations are explicitly acknowledged:

  • Performance: Large text blocks can negatively impact responsiveness, requiring the use of a specific LargeText widget.
  • Widget Catalog: The library lacks rich text, tree widgets, and date pickers.
  • Theming: There is no robust theming system; styling is currently verbose and limited to basic accent colors for some widgets.
  • Platform Support: Support is currently limited to desktop environments; there is no current support for Android or iOS.

Development Methodology and AI Integration

Shirei is notable for its heavy integration of AI coding agents during development. Commit histories reveal significant contributions from multiple AI entities, including Claude, Codex, Composer, and Cursor Grok 4.5.

This approach has sparked debate among developers: some view it as an efficient way to handle the "meticulous grunt work" required to build a UI framework, while others criticize the resulting commit history as being impractical for human review due to massive, multi-thousand-line changes in single commits.

Comparison with Other Go GUI Frameworks

Shirei enters a landscape with several existing Go GUI options:

  • Wails: A popular alternative that uses a web-based frontend with a Go backend.
  • Fyne: Another native Go GUI toolkit.
  • Ebitengine: A GPU-accelerated game engine that some developers suggest is a more performant foundation for building custom UIs, particularly for underpowered hardware like the Raspberry Pi.

Sources