19 Nov 2026

Svelte without the DOM

Custom renderers and the unexpected places they take us

Stanislav Khromov Stanislav Khromov stanislav.garden

Follow along on your phone here

Stanislav Khromov

Stanislav Khromov

Software engineer at Schibsted · Stockholm

  • Svelte Ambassador and core team member
  • Work in media
  • Open-source packages with Svelte and Bun
  • stanislav.garden
  • github.com/khromov
  • bsky.app/profile/khromov.se
  • youtube.com/@StanislavKhromov
  • khromov.se/blog

Part one

A brief history of Svelte

Once upon a time, in 2016

Forged by Rich Harris

…in the spirit of web standards

  • HTML for templates
  • CSS for styling
  • JS the language of the web
Rich Harris

Rich, at the anvil

2016 to 2026

Ten years, mostly on the web

2016 2018 2020 2022 2024 2026
Svelte 1 the compiler idea
Svelte 3 truly reactive
SvelteKit 1.0 the app framework
Svelte 5 runes
Svelte Native 2019 · on NativeScript · native apps, with some success

Since 2016

A lot has changed

…and Svelte has mostly kept up

The new meta for JS frameworks

Lightweight Svelte fits right in
Signals without Virtual DOM Svelte skipped the virtual DOM from day one

But also…

The rise of React Native One team, every platform
Rich Harris

“Virtual DOM is pure overhead”

…and AI, of course

Part two

Custom renderers

Svelte, minus the DOM

What is a custom renderer?

Svelte only ever spoke DOM

Before
Counter.svelte compiled JS document.createElement('button') hard-coded
With a custom renderer
Counter.svelte compiled JS renderer.createElement('button') yours
Let’s build the world’s worst custom renderer.

Step 1 of 2

A simple renderer

renderer.js
import { createRenderer } from 'svelte/renderer';

export default createRenderer({});

Step 1 of 2

Inserting nodes

renderer.js
export default createRenderer({
// …create and walk nodes, from the last slide

insert(parent, n) {
parent.children.push(...nodesToInsert(n));
n.parent = parent;
if (parent === root) print(n);
},
});

function nodesToInsert(n) {
return n.name === 'fragment' ? n.children : [n];
}

function print(n) {
const [first] = n.children;
if (first) console.log(`[${n.name}] ${first.text}`);
}
App.svelte
<h1>Hello world</h1>
Svelte calls, in order
  1. …
  2. createElement("h1")
  3. createFragment()
  4. createTextNode("Hello world")
  5. insert(fragment, text)
  6. insert(h1, fragment)
  7. insert(fragment, h1)
  8. …
  9. insert(root, h1)
Terminal
$ node main.js[h1] Hello world

Wiring

Enabling our custom renderer

  1. Tell the compiler where the renderer lives, then mount as usual into a node of your own
main.js
import { compile } from 'svelte/compiler';
import { mount } from 'svelte';
import renderer, { root } from './renderer.js';
import App from './App.svelte';

const { js } = compile(source, {
generate: 'client',
experimental: {
customRenderer: './renderer.js',
},
});

mount(App, { renderer, target: root });

Once you can write a renderer

A lot of doors open

  • …mobile apps
  • …desktop apps
  • …and some other devices too!
Device
PSP
CPU
333 MHz
Memory
32 MB
Released
2004
Device
Nintendo 3DS
CPU
268 MHz
Memory
128 MB
Released
2011

Running on PocketJS

The Wolfensvelte-3D repository on GitHub
github.com/snuffyDev/Wolfensvelte-3D

Wait, was that Wolfenstein?

Wolfensvelte 3D

snuffy@snuffyDev Wolfenstein 3D rebuilt in Svelte for Svelte Hack 2023. Every wall is a DOM element moved with CSS 3D transforms: no canvas, no WebGL.

That was fun. Now let’s get practical.

03 · Part three

Desktop apps

Svelte drawn by GPUI

Three gpuix-svelte demo windows: Hacker News, tic-tac-toe and a counter
The Zed website
zed.dev

Zed + GPUI

A code editor whose team built their own GPU UI framework, GPUI, tuned for exactly that job.

The gpuix website
gpuix.dev

gpuix

Node/Bun bindings for GPUI, as well as React + Solid support. Prebuilt, so no Rust toolchain is needed.

The gpuix-svelte website
gpuix-svelte.stanislav.garden

gpuix-svelte

Svelte support for gpuix.

Base architecture

How Svelte code connects to GPUI

App.svelte
<script lang="ts">
let count = $state(0);
</script>
Bun or Node.js an in-memory JavaScript VM
<div class="app">
<text class="count">{count}</text>
<div class="btn" onclick={() => count++}>Add one</div>
</div>
GPUI elements div, text, img, svg, input…
<style>
.btn {
padding: 12px 24px;
border-radius: 8px;
}
</style>
GPUI style objects translated at compile time, no CSS engine
So, where does my code run?
The frontend is the backend.

The frontend is the backend

No API layer to write

App.svelte
<script lang="ts">
import { readdirSync } from 'node:fs';
import { homedir } from 'node:os';

let files = $state(readdirSync(homedir()));
</script>

{#each files as file}
<text>{file}</text>
{/each}

Read the file system, straight from a component

My app

~

Documents/Downloads/side-project-41/side-project-42/definitely-not-memes/final_FINAL_v7.psdtodo-from-2019.txt

everything
else

gpuix-svelte

The GUI engine is one piece of the puzzle

The custom renderer about 180 lines at its core

  • Native functionality task bar icon, context menus, notifications
  • Building an executable .app and .exe, signing, notarizing
  • Testing
  • Dev tools and hot reload There is no browser!
  • Automatic updates
  • A new paradigm no CSS engine, no DOM

Can you build a real app with it?

Yes, and people have

Built with gpuix-svelte

editmd-gpuix

by Ilja

A Markdown editor. A port of editmd, a Swift app, to Svelte.

github.com/fubits1/svelte-gpuix-editmd

cmdmark

by d1lanX

Bookmark shell commands, launch them, watch their logs.

github.com/d1lanX/cmdmark

Strata

A local-first second brain, written in Svelte

The Strata app window

Strata · every model runs on your machine

Local AI, inside a Svelte app

  • Voice recognition Whisper base
  • Image search CLIP ViT-B/32
  • Semantic search nomic-embed-text v1.5
  • Chat with your data Gemma 4 E4B, on WebGPU

04

Is there another way to build a custom renderer?

Zooming out

Two ways to build a custom renderer

1 JavaScript is the host gpuix-svelte

Svelte Custom renderer JavaScript JS runtime Native bindings

2 Native is the host

Svelte Custom renderer Native code Native runtime (C, Rust, etc.)

Invert the dependency: start from a native project, add Svelte on top, emit native code.

CUI's component showcase
CUI’s own showcase

The engine I picked

CUI

A UI library in C99 with about 190 ready-made components.

  • No dependencies
  • Components come styled: themes, not CSS

OK, but if it’s so limited, what’s the point?

≈250 KB

…for a complete CUI app.

World’s smallest Svelte app challenge!

World’s smallest Svelte app

The plan

  1. Compile Svelte straight to C Markup becomes function calls
  2. Ignore the styling The components come styled
  3. The <script> tag… Damn.

We really just need something that runs JavaScript…

smallest javascript engine
bellard.org › quickjs QuickJS JavaScript Engine A small and embeddable JavaScript engine.

The plan, step one

Svelte in, C out

App.svelte
<Button
variant="primary"
onclick={() => clicks++}
>
Click me
</Button>

<Text>Clicked {clicks} times</Text>
Custom renderer
generated C
{ /* <Button> k5 */
cui_button_opts o = {0};
o.variant = CUI_BUTTON_PRIMARY;
bool r = cui_button_ex(ui, "Click me###k5", &o);
if (r) cuisv_emit(s, 2);
}
{ /* <Text> k6 */
cui_text_opts o = {0};
cuisv_text_inherit(&o);
cui_text_ex(ui, cuisv_str(s, 3), &o);
}
  • cuisv_emit queues the click for JavaScript
  • cuisv_str reads a slot that Svelte’s effect wrote

Svelte, compiled to C

Let’s build a simple todo app!

Add QuickJS for the script tags, and…

Compile it like any C program

~/tasks
$ cui-svelte build main.ts bundle esbuild + the Svelte compiler 175 ms codegen c_App_svelte.c c_Task_svelte.c compile CUI · QuickJS · runtime 11.4 s link Cocoa · QuartzCore · OpenGL✓ dist/tasks 1.9 MB

First build about 12 seconds. After an edit, under one.

The todo app, as a Mac executable

1.9 MB

about 1 MB zipped

Code and data

  • QuickJS 970 KB
  • CUI 555 KB
  • JS bundle 103 KB
  • Bridge 50 KB
  • Components 3.6 KB

The Svelte runtime is 59 KB of that. Your components, compiled to C: 3.6 KB.

For scale: the same kind of app on Bun plus native bindings ships at about 110 MB.

Todo app, C + QuickJS
1.9 MB
A gpuix-svelte app
≈110 MB

Part five

The hard parts

What every custom renderer runs into

The question every renderer runs into

Should one component render on the web and natively?

No

Is it really Svelte if you can’t show the component in a browser? 😅

Yes
  • Native styling is (usually) not full CSS.
  • Custom structure semantics, eg <View>, <Row> & <Grid>. Do you replicate these on the web so a component runs on both?
  • A long tail of small differences.

One codebase

Same components, two renderers

SvelteKit in a browser gpuix-svelte in a GPUI window
The same components in a browser and in a GPUI window

Why are we
even doing
this?

Isn’t AI about to make all frameworks obsolete?

“It’s easy to write a native codebase now!”
“AI can maintain the code.”
“Nobody reads the code anymore.”
At the end of the day, a person is responsible for the codebase.
AI helps. It does not replace us (yet).

Svelte’s simple semantics

A language you know is a superpower

  1. Debug what you understand Would you trust the AI’s Rust, C or Zig?
  2. One codebase, web included Every platform stays in sync
  3. Less code, fewer tokens Cheaper and faster

06 · Part six

Where we stand today

Desktop, today

New engines spring up like mushrooms

Rune Rust · by the OpenCode team
zgui Rust · signals and a CSS engine
exact by Expo · web, macOS, iOS, Linux

+ every engine
that already exists

What an engine needs for a custom renderer

JS bindings (Node, Bun), or generate native code directly

And what about mobile?

Svelte 5 is reaching phones

  • Svelte Native On NativeScript: Svelte 4, with Svelte 5 in alpha
  • wobsoriano/svelte-native On React Native’s Fabric, runs in Expo Go
  • lynx-svelte On Lynx: iOS, Android, web and desktop
  • symbiote-native One native core on Fabric, an adapter per framework
A Svelte 5 app running natively on an iPhone
A chat message from Zeke, “gpuix-svelte on ios and android”, with the same counter app in an iPhone simulator, a desktop window and an Android emulator

Another challenger joins the ring!

gpuix-svelte, running on iOS and Android.

The DOM was only the beginning for Svelte.

What device would you like to see Svelte run on? + questions

Join on your phone

Thank you

  • github.com/khromov
  • bsky.app/profile/khromov.se
  • youtube.com/@StanislavKhromov
  • stanislav.garden

stanislav.garden/talks/svelte-everywhere