Turf: Pure zig cross-platform webview library

Webview-based desktop apps are all the rage now. I didn’t really like Electron since it ties you to JavaScript everywhere and its huge. I’m not a rust programmer, so Tauri is out. The popular “webview” C/C++ library has things about it I didn’t like, so a pure Zig library was in order.

So here’s turf -

  • Cross-platform … compiles on Linux, Windows, MacOS

  • Uses WkWebview on Mac, GTK4/WebKit on Linux, system EdgeWebView2 on Windows

  • Bidirectional comms between JS and Zig happens through passing JSON messages

  • Tiny binaries: 256k on Mac, 11k on Windows, 200k on Linux. (–release=small)

  • Web files (index.html, js code) are embedded in the binary with @embedfile

11 Likes