Skip to content

Why GTKX ​

In a typical GTK application, code creates the widget tree and then keeps each widget in step with application state by hand: every change in state means finding the affected widgets and calling their setters. Web development moved past this years ago. Declarative components, a dev server with Fast Refresh, tests that query the interface the way a user sees it, and one-command builds are standard there, along with the React and npm ecosystems built around them.

GTKX brings that workflow to native GTK and Adwaita apps. You describe the interface in JSX; GTKX renders real Adwaita and GTK widgets, and React updates them when state changes.

Why Node.js ​

GTKX runs your app on Node.js. Node owns the process, and GTKX drives GLib's main loop, which GTK uses for input, drawing, and timers, from Node's event loop on the main thread. Your app is an ordinary Node program, so it can use Node's standard library and npm packages, and GTKX's development and test tooling builds on Vite and Vitest. GLib and Gio bindings cover platform APIs such as settings, actions, and notifications.

Platform scope ​

GTKX targets one platform, GTK and Adwaita on Linux, rather than abstracting over several. Your app uses the native libraries' own APIs, not a cross-platform subset of them. GTKX does not provide a Windows, macOS, mobile, or browser renderer. Comparisons describes how GTKX differs from GJS, node-gtk, React Native, gtk4-rs and Relm4, and Electron and Tauri.

GTKX generates TypeScript bindings from the native libraries installed for your project. Shipping an app still requires compatible native libraries; see Deploying.

Components render native widgets, so web UI libraries that expect HTML, the DOM, or browser CSS need to be replaced or adapted. React hooks and libraries that work independently of a renderer can be reused. GTK styles use GTK CSS, whose properties and layout differ from the web.

Development tools ​

npm run dev opens your app, and Fast Refresh updates the open window as you save while preserving component state. Tests run in Vitest, find widgets by role and name, and click and type into the real native interface on a private headless display. npm run deploy builds Flatpak, Debian, RPM, and AppImage packages from your configuration; see Deploying. Coding agents can inspect and drive the running app through the MCP server.

Libraries cover common app structure: navigation maps React Navigation to native page stacks, tabs, drawers, and split views; components render collections and notifications; and forms connect native controls to React Hook Form.

Credits ​

GTKX builds on React, Vite, Vitest, napi-rs, and React Navigation. Its GObject APIs follow the names and conventions of GJS.

Comparisons ​

Several projects build GTK and Adwaita apps, or desktop apps with React and web technologies.

GJS ​

GJS is GNOME's JavaScript runtime. Your JavaScript runs inside GLib's main loop, in a runtime that implements neither the Node.js APIs nor most Web APIs. npm packages that depend on those APIs, and tools that run on Node.js such as Vitest, don't work with a GJS app.

GTKX reverses that arrangement: Node.js owns the process, and GLib's main loop runs inside it (see Why Node.js). The app is an ordinary Node.js program, so it can use npm packages, Vite and Vitest. GTKX's GObject APIs follow GJS's names and conventions, so knowledge of GJS carries over.

GJS is the better fit for GNOME Shell extensions, which run inside GNOME Shell's own GJS, and for apps that should use the runtime GNOME already provides: a GJS app's Flatpak takes GJS from the GNOME runtime, while a GTKX package includes Node.js.

node-gtk ​

node-gtk also runs GTK inside a Node.js process, through GObject Introspection bindings. Its API is imperative: code creates widgets and calls their methods to keep them in step with state. It is built on Nan rather than Node-API, the interface that lets an addon compiled for one Node.js major version run on later ones without recompiling, and it generates TypeScript declarations on request. It also ships a project scaffolder, CSS hot reloading and Flatpak bundling.

GTKX renders declarative React components, and its native addon is written in Rust on Node-API. It is TypeScript-first: codegen generates typed bindings and JSX props for the libraries your project uses.

React Native ​

React Native builds native apps with React. Its core targets Android and iOS, and separately maintained out-of-tree platforms add others such as macOS and Windows; none of them renders GTK or Adwaita. Its components abstract over the differences between platforms, which makes it the better fit when one codebase must run on several of them.

GTKX targets one platform and exposes all of it: every GTK and Adwaita widget and API the installed libraries provide, under its native name. Readers who know React Native will recognize navigation, which maps React Navigation to Adwaita page stacks, tabs, drawers and split views.

gtk4-rs and Relm4 ​

gtk4-rs is the Rust binding for GTK 4. Code builds and updates widgets imperatively, or loads them from UI templates. Relm4 builds on gtk4-rs with an Elm-inspired component model and a view! macro that declares the UI. Both suit apps written in Rust. Neither provides hot reloading, a dev server or UI test automation; gtk4-rs's #[gtk::test] attribute runs a test on the GTK main thread, and driving the interface is left to the test.

GTKX includes those tools along with React: a dev server with Fast Refresh, tests that find widgets by role and name and click and type into the real interface on a headless display, and packaging for Flatpak, Debian, RPM and AppImage.

Electron and Tauri ​

Electron and Tauri build desktop apps whose interface is a web page written in HTML, CSS and JavaScript. Electron bundles Chromium and Node.js into each app. Tauri renders in the operating system's webview, WebKitGTK on Linux, and runs backend logic in Rust. Both build for Windows, macOS and Linux from one codebase, and Tauri also builds for Android and iOS.

GTKX renders native GTK and Adwaita widgets instead of a web page, so an app gets the platform's look, accessibility and desktop integration, on Linux only. Its React components create widgets rather than DOM elements, so UI libraries that render to the DOM don't apply.

Electron and Tauri are the better fit when one web codebase must run on several desktop platforms, or when the interface reuses DOM UI libraries.