A "No-DOM" GUI Runtime: SolidJS Logic driving Rust GPUI Rendering.
Alloy is an experimental attempt to break free from the Electron paradigm. instead of shipping a full browser, we run compiled SolidJS logic in a lightweight QuickJS container, communicating via a high-performance Binary Command Buffer to a native Rust rendering engine (GPUI).
The Result? A desktop app architecture that retains the DX of React/Solid but targets the performance profile of native Rust applications.
Alloy is designed with a 3-stage evolution path, moving from a hybrid experiment to a fully native platform.
- Goal: Prove the "JS Logic -> Native Render" architecture.
- Stack: SolidJS (JSX) + QuickJS + Rust GPUI.
- Mechanism: JS writes drawing commands to a
Uint8Array; Rust flushes and renders. - Status: ✅ Basic Concept Proven (You are here).
- Goal: Freeze the Binary Protocol (ABI).
- Plan: Define a standard set of OpCodes (
Create,Style,Layout). - Benefit: Any language that can emit this binary stream (Python, Go, Lua) can drive the UI.
- Goal: Replace QuickJS with Wasmtime.
- Plan: Design a component-based framework supporting both JSX and template syntax, natively compiling HTML/CSS/AssemblyScript into Wasm, while any other Wasm-compatible language can drive the UI.
- Benefit: Near-native logic performance, Shared Memory threading, and reduced GC pauses.
Alloy uses a Command Buffer Pattern inspired by game engines. The Frontend does not touch the OS; it simply queues instructions.
graph LR
subgraph "JS Realm (Logic)"
A[SolidJS Component] -->|Reactivity| B[Custom Renderer]
B -->|GenNode| C[Binary Encoder]
C -->|Uint8Array| D[Shared Buffer]
end
subgraph "Rust Realm (Engine)"
D -->|Flush| E[Command Parser]
E -->|Apply| F[Shadow DOM]
F -->|Render| G[GPUI Window]
end
- Zero DOM: No browser reflows/repaints. Layout is handled by Rust.
- One FFI Call: We don't cross the JS/Rust bridge for every element. We batch commands and flush once per frame.
- Binary Protocol: Commands are encoded in a compact binary format (avg 75% smaller than JSON).
- Rust (latest stable)
- Node.js & npm
- macOS (Verified) or Linux/Windows (Experimental support via GPUI)
-
Build the Frontend Shim
cd frontend npm install && npm run build
-
Compile & Run the Engine
cd .. cargo run --release
Communication happens via __alloy_flush(buffer).
Example Payload (Create a <div>):
[OpCode: 1] [ID: 1] [Len: 3] [Bytes: "div"]
- ✅ Elements:
div,button,text. - ✅ Styling: Basic Flexbox (
flex-direction,gap,padding), Colors (#hex), Radius. - ✅ Events:
onClick(dispatched from Rust back to JS). - ✅ Reactivity: Full SolidJS Signal/Effect support.
This is a Proof of Concept validating the SolidJS → Binary → Rust architecture, realized through AI-Accelerated Development ("Vibe Coding").
While the architectural vision is intentional, much of the implementation boilerplate was generated by LLMs. As a result, the project is fast-moving but rough around the edges—currently, only the Logic Pipeline is fully functional.
- ✅ Reactivity: Clicking the button updates the JS state, sends binary commands, and triggers a re-render.
- 🚧 Styling: The Style engine is WIP. CSS properties are parsed, but due to the AI's limited context on GPUI internals, they don't yet visually apply in the Rust backend. (A perfect "Good First Issue" for human experts!)
Interested in the future of GUI? We need human insight to refine the AI-generated boilerplate, understand GPUI internals, and expand the CSS subset. Feel free to open issues or PRs!
MIT
