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
0
Hello World from gpuix-svelte!

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.

  1. App.svelte Your component
  2. svelte/compiler Compiles it to JavaScript
  1. DOM calls
  2. The browser’s DOM createElement, appendChild, …
  3. The browser lays out and paints
  4. A tab or a webview
  1. with customRenderer
  2. Shadow tree In JavaScript. Only elements and non-blank text become GPUI nodes.
  3. applyBatch(json) One batch per frame
  4. @gpuix/native Prebuilt Rust addon
  5. GPUI Lays out with flexbox and paints
  6. Metal on macOS, DirectX on Windows, Vulkan on Linux
  7. 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.

starter/App.svelte

<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>
The starter app’s window, captured on macOS: a dark card with the count 2, an outlined minus button, a white plus button and the hint “Edit App.svelte and save — the window hot-reloads.”

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.

starter/App.svelte

	.btn.primary {
		border-color: #ededed;
		background-color: #ededed;
		color: #000000;
		border-color: #ff3e00;
		background-color: #ff3e00;
		color: #ffffff;
	}
[gpuix-svelte] remount complete
State that survives a reload

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.

README · App.svelte

<style>
…
.btn { padding: 12px 24px; border-radius: 8px; background-color: #111111; color: #ededed; }
.btn:hover { background-color: #1c1c1c; }
</style>
Styling docs

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.

starter/test.ts

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
Headless tests and automation

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.
…
The docs as llms.txt

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.

macOS. Drawing of the dist folder, holding one executable, app. Its icon is a black rounded square with depth and a soft shadow, with the gpuix-svelte mark above its name in white.
Windows. Drawing of the dist folder in my-app, holding one executable, app. Its icon is a flat black square tile with the gpuix-svelte mark above its name in white.
Linux. Drawing of the dist folder in my-app, holding one executable, app. Its icon is a black rounded tile with a grey base edge and the gpuix-svelte mark above its name in white.

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.

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-list and a few more. Anything else renders as a div, 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 :root rule, and one set_css_vars() call to switch them. A theme switch restyles in one batch. More in the styling docs.
Included utilities
Scroller, Portal, Tooltip and Popover, 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!