Turn Any Web Browser Into a Lightweight GUI for Your Backend Code
You've got a C, C++, or Python backend that does real work, but you dread the UI layer. Traditional GUI toolkits feel ancient and clunky, while bundling a full Electron app means shipping megabytes of Chromium just for a settings panel. What if you could use any web browser as your frontend, keep your existing backend language, and end up with a library that's only a few kilobytes? That's exactly what WebUI offers—a portable, single-header library that lets any web browser serve as your application's graphical interface.
What It Does
WebUI is a lightweight C library (with wrappers for many languages) that turns a web browser into a GUI for your backend code. The core idea is simple: your application starts a local web server, opens a browser window, and communicates via a fast binary WebSocket protocol. You write your frontend in HTML, CSS, and JavaScript—modern web technologies you probably already know—while your backend runs in whatever language you prefer.
The library is designed to be portable and minimal. It's a single header file, weighs only a few kilobytes, and requires nothing more than a web browser at runtime. A WebView is optional, meaning you don't need to bundle a browser engine or install heavy SDKs. It supports multiple platforms and multiple browsers, and it uses a private browser profile for safety, so your app's browsing doesn't mix with the user's personal browser data.
Why It's Cool
WebUI takes a pragmatic approach to a problem that's been solved poorly for years. Here's what makes it stand out:
-
It's genuinely lightweight. At a few kilobytes, this library makes Electron look like a shipping container. You're not asking users to download a web runtime; you're asking them to use the browser they already have.
-
No SDK hell. WebView-based solutions often require platform-specific SDKs and have complex build chains. WebUI strips that away. You compile one header, link the library, and you're done.
-
Real browser features. A WebView is a stripped-down browser component. WebUI uses actual browsers, which means your users get full support for modern CSS, JavaScript APIs, and developer tools. Debugging your UI is as simple as opening the browser's inspector.
-
The binary WebSocket protocol. Instead of sending JSON strings back and forth, WebUI uses a fast binary protocol for communication between frontend and backend. That's a thoughtful design choice for applications where performance matters.
-
It's language-agnostic on the backend. The core is C, but there are wrappers for Python, Go, Rust, TypeScript, and others. You don't have to rewrite your existing backend to use this.
-
Private profiles by default. When your app opens a browser window, it uses a separate profile that won't affect the user's bookmarks, cookies, or saved passwords. That's a small detail that shows the team thought about real-world usage.
How to Try It
Getting started with WebUI is straightforward. Head to the GitHub repository and grab the latest release. The library ships as prebuilt binaries for common platforms, or you can build from source.
The basic pattern in C looks something like this:
#include "webui.h"
int main() {
webui_window_t *my_window = webui_new_window();
webui_show(my_window, "<html>Hello from WebUI</html>");
webui_wait();
return 0;
}
You pass HTML directly as a string, or you can point to an HTML file. The webui_wait() call keeps your application running until the browser window closes. For two-way communication, you register JavaScript functions that call back into your C code.
The repository includes examples for C, C++, Python, and other languages. There are also nightly builds and a stable release channel. If you want to ask questions or explore the API, there's even a dedicated GPT for WebUI that can answer C and C++ usage questions.
Final Thoughts
WebUI isn't trying to replace Electron for complex desktop applications that need deep OS integration. But for the vast majority of tools, utilities, and internal applications where you just need a decent UI without the bloat, it's an elegant solution. If you've ever spent an afternoon wrestling with GTK, Qt, or a WebView SDK, you'll appreciate how refreshing it is to open a browser tab and call it done. Give it a try on your next small project—you might find yourself reaching for it more often than you expect.
Follow @githubprojects for more developer tools and open source projects.