Build native desktop apps with Svelte
gpuix-svelte renders your Svelte components into a native, gpu-accelerated application on macOS, Windows and Linux, with no browser. You can access anything on the user's computer using Node or Bun APIs.
npm create gpuix-svelte@latest my-app
Quick start
Scaffolding a gpuix-svelte application is easy, you'll need Node.js 24 or later, or Bun 1.4 or later.
On Bun, run bun create gpuix-svelte my-app, then cd my-app, bun install and bun run start.
$ npm create gpuix-svelte@latest my-app Created my-app. Next: cd my-app npm install npm start # opens the window; edit App.svelte to hot-reload npm test # headless test (macOS and Windows) npm run build # standalone executable in dist/ (requires Bun)
How it works
gpuix-svelte uses the experimental Svelte custom renderers feature, which lets the compiler emit calls to a renderer of your choice.
App.svelteYour componentsvelte/compilerCompiles it to JavaScript
- DOM calls
- The browser’s DOM
createElement,appendChild, … - The browser lays out and paints
- A tab or a webview
- with
customRenderer - Shadow tree In JavaScript. Only elements and non-blank text become GPUI nodes.
applyBatchOne batch per frame(json) @gpuix/nativePrebuilt Rust addon- GPUI Lays out with flexbox and paints
- Metal on macOS, DirectX on Windows, Vulkan on Linux
- A native window No DOM or webview in the process
gpuix-svelte maps ordinary Svelte components onto GPUI, the GPU-accelerated UI framework behind the Zed editor, through Svelte’s unreleased custom renderer API. Your markup, runes and <style> class rules compile as usual, and every element becomes a GPUI node. The screenshot is the starter’s window on macOS; each outline is what one line of App.svelte draws.
<script lang="ts">
let count = $state(0);
</script>
<div class="app">
<div class="card">
<div class="count" testId="count">{count}</div>
<div class="row">
<div class="btn" testId="minus" onclick={() => count--}>-</div>
<div class="btn primary" testId="plus" onclick={() => count++}>+</div>
</div>
<div class="hint">Edit App.svelte and save — the window hot-reloads.</div>
</div>
</div>
Batteries included
Hot reload
gpuix-svelte has built-in hot reloading, just like you’re used to. Save a file and the open window updates in place.
.btn.primary {
border-color: #ededed;
background-color: #ededed;
color: #000000;
border-color: #ff3e00;
background-color: #ff3e00;
color: #ffffff;
}
[gpuix-svelte] remount complete
Styling
Style your components with scoped <style> blocks, just like on the web. Class rules, :hover and flexbox layout all work as you’d expect.
<style>
…
.btn { padding: 12px 24px; border-radius: 8px; background-color: #111111; color: #ededed; }
.btn:hover { background-color: #1c1c1c; }
</style>
Testing
Testing is built in, too. Mount a component headlessly and click through it with real hit testing, no window needed, or drive a running app from another process.
click_test_id('plus');
click_test_id('plus');
click_test_id('minus');
check('the buttons reached the counter', all_text().includes('1'));
$ npm test ok the buttons reached the counter
Agentic-ready
gpuix-svelte is ready for AI development with your favourite agent of choice. The starter ships an AGENTS.md, and the docs are published as llms.txt.
$ curl -s https://gpuix-svelte.stanislav.garden/llms.txt # gpuix-svelte > A Svelte custom renderer for GPUI, the GPU-accelerated UI framework behind the Zed editor: Svelte 5 components rendered straight into a native desktop window. …
Shipping
You can easily ship self-contained, signed executables on Windows, Mac and Linux. npm run build bundles your app, the runtime and GPUI into a single file. The shipping docs cover the macOS .app, signing and notarization, and the same app can also run in a browser on GPUI’s WebAssembly build.
Examples
There are plenty of examples to get you started on your first native app with Svelte. Each card links to its source in the repository’s examples/ folder.
-

Counter
A counter and a keyed list, hot-reloading on save
-

Tic-tac-toe
Wins and draws counted across rounds
-

Styling playground
Which CSS reaches GPUI and which is dropped, side by side
-

Control center
A translucent panel over macOS vibrancy
-

Hacker News
Live network data in a scrolling list
-

Tic-tac-toe on the web
The same game in a browser, on GPUI’s WebAssembly build
-

Desktop APIs
Window controls, file drops, images from raw pixels and focus
-

Tutorial
A 12-step interactive guide, itself a gpuix-svelte app
Coming from Svelte on the web
Most of the things you know and love from Svelte work out of the box, but some things are different in the native gpuix environment.
Works as usual
- $state
- $derived
- $effect
- $props
- {#snippet}
- {#each}
- {#if}
- {#await}
- <svelte:boundary>
- .svelte.ts
- <style>
- class:
- style:
- {@attach}
Different
- HTML elements map to native equivalents
- A fixed set of tags:
div,text,img,input,textarea,markdown,virtual-listand a few more. Anything else renders as adiv, with a warning. - Mouse events don’t bubble
- They go to the element under the pointer.
hitbox="self"on a clickable element lets clicks on its icons and badges reach it. More in the styling docs. - No
bind: - Inputs report through events with the value in the payload, and
{@attach}hands you the element. More in the guide. - Keyboard shortcuts
on_window_key('keydown', handler)hears every key, whatever has focus. More in the guide.- Theming
var(--token)in your styles, the values in a:rootrule, and oneset_css_vars()call to switch them. A theme switch restyles in one batch. More in the styling docs.- Included utilities
Scroller,Portal,TooltipandPopover, plus helpers for the window, the file picker, file drops and focus. More in the components docs.
Showcase
Want to showcase what you built with gpuix-svelte? Open an issue or PR to include it here!