A minimal skeleton project demonstrating SvelteKit running in a desktop app powered by Electrobun.
├── src/
│ ├── bun/
│ │ └── index.ts # Main process (Electrobun)
│ ├── routes/
│ │ ├── +layout.ts # Global prerender config
│ │ ├── +page.svelte # Home page
│ │ └── about/
│ │ └── +page.svelte # About page
│ └── app.css # Global styles with CSS variables
│ └── app.html # SvelteKit app template
├── electrobun.config.ts # Electrobun configuration
├── svelte.config.ts # SvelteKit configuration
└── vite.config.ts # Vite configuration
bun install
Option 1: Standard dev mode (no HMR)
bun run dev
Option 2: Dev mode with HMR
bun run dev:hmr
This runs the Vite dev server on http://localhost:5173 alongside Electrobun. Changes to your Svelte components will hot-reload instantly.
bun run build
Builds the SvelteKit app with adapter-static and packages it with Electrobun.
Production build with channel:
bun run build:prod
File-based routing works seamlessly in the desktop app:
/ - Home page with interactive counter/about - About page demonstrating navigationAll routes are prerendered at build time using adapter-static. The +layout.ts file sets global prerender configuration:
export const prerender = true;
export const ssr = true;
Global styles use CSS variables for easy theming:
--color-primary, --color-secondary, --color-text--shadow-primary, --shadow-primary-hover.primary, .secondaryAll Vite commands use bunx --bun vite to ensure Bun's runtime is used instead of Node.js.
The svelte.config.ts uses minimal configuration with sensible defaults:
import adapter from '@sveltejs/adapter-static';
export default {
kit: {
adapter: adapter({
pages: 'dist',
assets: 'dist'
})
},
compilerOptions: {
runes: true
}
};
The electrobun.config.ts copies the built SvelteKit app to Electrobun's views directory:
buildConfig: {
copy: [
{ from: 'dist', to: 'views/mainview' }
]
}