egui FFI
Minimal bridge between Bun/TypeScript and Rust's egui via a cdylib and Bun FFI, with event-based bidirectional messaging, reactive state and a counter demo; solves the macOS main-thread requirement. First step toward driving native egui UIs from JavaScript.
- BPM
- 136
- GRADE
- B
- LEVEL
- 5
- RELEASES
- 0
- YEARS
- 2025–2025
The Main Thread Problem
This time I dropped the toolchain. No Neon, no build machinery, just a Rust cdylib and Bun's own FFI calling into it. One day, May 6 2025, and a counter demo to show it worked.
The hard part on a Mac is that AppKit wants the window on the main thread, and the JavaScript runtime wants that thread too. Getting egui to render while TypeScript stayed responsive meant figuring out who owns the loop and passing events across in both directions instead of making blocking calls. Once that worked, the reactive state on top was easy, and I was happy to see a button increment a number.
This was one of the egui experiments that May, alongside the Neon binding and the virtual DOM. Going down to raw FFI is what made it work, and it eventually grew into Gouda. Not long after I was wrapping the Boa engine in a CLI and calling it Guava Script.
led to
- tish-egui2026Bun FFI bridge to egui