Native cross-platform desktop apps with a C++ backend and a React + Vite UI. No Electron, no Node at runtime — one small binary that renders your React app in the operating system's built-in webview.
cite++ (repo: citepp) is a GitHub template repository for building desktop
applications where:
- the UI is a modern React + Vite + TypeScript app,
- the backend / heavy logic is C++,
- the two talk through webview/webview: C++ functions are bound into JavaScript,
and React simply
awaits them.
[React UI] --await window.countPrimes(n)--> [C++ backend]
(webview) <----- { primes, ms } JSON ------ (main.cpp)
The name is a play on Vite + C++ ("cite" + "++").
Use it when you want native desktop performance and a real systems language for the backend (file I/O, number crunching, hardware access, existing C++ libraries) but a fast, familiar web stack for the interface.
Good fits: internal tools, data/report generators, engineering utilities, anything that would be heavy or slow in pure JavaScript. The included demo is intentionally minimal — it shows the two communication directions and nothing else:
countPrimes(n)— React sends an argument, C++ computes, returns the result.systemInfo()— React asks with no arguments, C++ returns data.
Why not Electron: Electron bundles a full Chromium + Node runtime (~100 MB, high RAM).
cite++ uses the OS webview instead:
| OS | Engine | Notes |
|---|---|---|
| Windows | WebView2 | Runtime preinstalled on Windows 10/11 |
| Linux | WebKitGTK | libgtk-3-dev libwebkit2gtk-4.1-dev |
| macOS | WKWebView | Xcode command line tools |
Result: one binary, a few MB instead of a hundred.
-
CMake >= 3.19, Ninja, a C++17 compiler
-
Node.js 18+ (for building the frontend) and Python 3.8+ (task runner)
-
Windows: MinGW-w64 only. MSVC is intentionally rejected by CMake. Install via MSYS2 and work from the UCRT64 shell:
pacman -S mingw-w64-ucrt-x86_64-gcc \ mingw-w64-ucrt-x86_64-cmake \ mingw-w64-ucrt-x86_64-ninjaOn Windows, run every command below from the "MSYS2 UCRT64" terminal so
g++,cmakeandninjaare onPATH.
Click "Use this template" on GitHub, or:
gh repo create my-app --template <your-user>/citepptasks.py Python task runner (build / run / package)
src/main.cpp C++ backend: the JS bindings (2 demo functions)
frontend/ React + Vite + TypeScript
src/bridge.ts typed wrapper over the C++ binds (single source of truth)
src/App.tsx demo UI: prime counter + system info
CMakeLists.txt build config; forbids MSVC, MinGW-only on Windows
CMakePresets.json Ninja presets (default, windows-mingw)
.github/workflows/ CI matrix: Windows (MinGW) / Linux / macOS
- C++ (
src/main.cpp):w.bind("myFunc", [](const std::string& req){ /* ... */ return json; }); - Types (
frontend/src/bridge.ts): addmyFuncto theWindowinterface and to thebackendobject. - React:
const r = await backend.myFunc(args);
The C++ receives the JS arguments as a JSON array string and must return a JSON string, which becomes the resolved value of the JS promise.
All day-to-day work goes through tasks.py (standard library only, cross-platform):
python tasks.py run-debug # build + run in Debug
python tasks.py run-release # build + run in Release
python tasks.py compile-release # build Release + package a shareable zip
python tasks.py compile-release --release # + create git tag vX.Y.Z
python tasks.py compile-release --release --publish # + publish GitHub release (gh)Each command runs the frontend build first, then the C++ build, using per-config
build directories (build-debug/, build-release/).
Manual build (what the task runner automates):
# 1. Frontend -> frontend/dist
cd frontend && npm install && npm run build && cd ..
# 2. C++ app (copies frontend/dist -> <build>/ui)
cmake --preset windows-mingw # Windows (MinGW)
cmake --preset default # Linux / macOS
cmake --build build
# 3. Run
./build/app # Linux/macOS
build\app.exe # WindowsOr simply: python tasks.py run-release.
python tasks.py run-debugThis builds the frontend with Vite development mode + source maps
(npm run build:debug, unminified) and the C++ side with CMAKE_BUILD_TYPE=Debug
(symbols, no optimization), then launches the app.
- C++ debugging: the Debug binary lives in
build-debug/app. Attachgdb(MSYS2 UCRT64 ships it):gdb build-debug/app. - Frontend debugging: in the running app, open the webview dev tools
(right-click → Inspect on platforms that expose it) — source maps map back to your
original
.tsx. - Fastest UI loop (hot reload): run
cd frontend && npm run dev(Vite athttp://localhost:5173), temporarily point the app at it by changingw.navigate(...)insrc/main.cpptow.navigate("http://localhost:5173");, rebuild the C++ once, and edit React with live reload. Revertnavigate()tofile://ui/index.htmlbefore shipping.
python tasks.py compile-releaseProduces artifacts/citepp-<version>-<os>.zip containing the binary, the built ui/,
README.md and LICENSE — ready to hand to a user on the same OS.
To also cut a versioned release (recommended):
python tasks.py compile-release --release --publish--releasecreates an annotated git tagvX.Y.Z(version read fromfrontend/package.json).--publishuploads the zip as a GitHub Release using theghCLI.
The version comes from frontend/package.json → bump it before cutting a release.
Runtime note: on the end user's machine the Windows build needs the WebView2 runtime (already present on Windows 10/11). Linux needs WebKitGTK libraries installed. Bundle/installer generation (
.msi/.AppImage/.dmg) is a natural next step and can be wired intocompile-release.
.github/workflows/build.yml builds the frontend, then the C++ app on
Windows (MSYS2/MinGW), Linux, and macOS, and uploads the binaries as
build artifacts on every push and pull request.
MIT — see LICENSE.