Skip to content
Agentmart
Submit a tool

sveltekit-tauri

SvelteKit frontend patterns for Tauri desktop apps.

Skill by 0tomi

IndexedMIT★ 3
Write a review

Chalk Labs

Need help deploying sveltekit-tauri?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/0tomi-sveltekit-tauri

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

SvelteKit frontend patterns for Tauri desktop apps. Use when writing Svelte components, pages, layouts, load functions, or routing in a Tauri project. Triggers on .svelte files, +page, +layout, +server, load function, SvelteKit, adapter, SSR, prerender. Complements the tauri-v2 skill (Rust backend); this skill owns the frontend boundary.

Use cases: frontend, backend, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/sveltekit-tauri

What's inside

Skill name
sveltekit-tauri
Description
SvelteKit frontend patterns for Tauri desktop apps. Use when writing Svelte components, pages, layouts, load functions, or routing in a Tauri project. Triggers on .svelte files, +page, +layout, +server, load function, SvelteKit, adapter, SSR, prerender. Complements the tauri-v2 skill (Rust backend); this skill owns the frontend boundary.
License
MIT
Instructions
163 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# SvelteKit in Tauri — Frontend Constraints

> Tauri renders SvelteKit as a **static SPA** inside a webview — there is no Node.js server. Every SvelteKit feature that assumes a server is unavailable.

## Rendering Mode

Tauri loads the built frontend from disk via the asset protocol. The app runs as a **Single-Page Application** using `@sveltejs/adapter-static` with `fallback: 'index.html'`. SSR is globally disabled at the root layout:

```typescript
// src/routes/+layout.ts
export const ssr = false;
```

This single export shapes everything below — keep it. Removing it breaks Tauri API access and causes hydration mismatches.

## Forbidden Patterns

These SvelteKit features require a running Node.js server. Tauri has none.

| Feature | Why it fails | Alternative |
|---------|-------------|-------------|
| `+server.ts` / `+server.js` (API routes) | No server to handle requests | Tauri commands via `invoke()` |
| `+page.server.ts` / `+layout.server.ts` | Server-only load functions need Node runtime | Use `+page.ts` / `+layout.ts` (universal load) |
| `actions` (form actions) | Requires server endpoints | Handle form submission client-side, call `invoke()` |
| `adapter-node` / `adapter-auto` | Produce server bundles Tauri cannot serve | `adapter-static` only |
| `cookies` / `locals` / `platform` in load | Server-only RequestEvent properties | Store state client-side or in Tauri managed state |
| `fetch` to own API routes | No server to receive the request | `invoke()` for Rust commands, `fetch` for external URLs |
| `$env/dynamic/private` | Server-only env vars | `$env/static/public` or Tauri env plugin |
| `event.setHeaders()` | Server-side response manipulation | Tauri HTTP headers config in `tauri.conf.json` |

**When you see a `+server.ts` file or server load function in a Tauri project, it is a bug.** Replace it with client-side logic + Tauri IPC.

## Universal Load Functions

All data loading happens in universal load functions (`+page.ts` / `+layout.ts`), which run in the browser. Tauri APIs are available here because SSR is off:

```typescript
// src/routes/dashboard/+page.ts
import { invoke } from '@tauri-apps/api/core';
import type { PageLoad } from './$types';

export const load: PageLoad = async () => {
  const stats = await invoke<DashboardStats>('get_dashboard_stats');
  return { stats };
};
```

If you use SSG with prerendering on specific routes (`export const prerender = true`), know that load functions **will not** have access to Tauri APIs during the build — `window.__TAURI__` does not exist at build time. SPA mode (no prerendering) is the safe default.

## Calling Tauri from Svelte Components

All Tauri API calls must run **client-side only**. With `ssr = false` globally, every component is client-only by default. Use `invoke` for Rust commands, `listen`/`emit` for events:

```svelte
<script lang="ts">
  import { invoke } from '@tauri-apps/api/core';
  import { listen } from '@tauri-apps/api/event';
  import { onMount, onDestroy } from 'svelte';

  let data = $state<string>('');
  let unlisten: (() => void) | undefined;

  onMount(async () => {
    data = await invoke<string>('greet', { name: 'World' });
    unlisten = await listen('backend-event', (e) => {
      console.log('Received:', e.payload);
    });
  });

  onDestroy(() => unlisten?.());
</script>

<p>{data}</p>
```

**Cleanup is mandatory.** Always call `unlisten()` in `onDestroy` for event listeners to prevent memory leaks across navigation.

## Routing

SvelteKit's client-side router works normally — `goto()`, `<a href>`, `+layout.svelte` nesting all function. The static adapter with `fallback: 'index.html'` handles deep-link fallbacks.

One caveat: **avoid `window.location` for navigation.** It triggers a full page reload inside the webview. Use SvelteKit's `goto()` instead:

```typescript
import { goto } from '$app/navigation';

// Correct — SPA navigation
goto('/settings');

// Wrong — full reload, loses app state
window.location.href = '/settings';
```

## Configuration Invariants

These files form the Tauri + SvelteKit contract. Do not alter without understanding the consequences.

**`svelte.config.js`** — must use `adapter-static` with `fallback: 'index.html'`:
```javascript
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

const config = {
  preprocess: vitePreprocess(),
  kit: {
    adapter: adapter({
      fallback: 'index.html',
    }),
  },
};

export default config;
```

**`tauri.conf.json`** — `frontendDist` points to `../build` (SvelteKit default output):
```json
{
  "build": {
    "beforeDevCommand": "pnpm dev",

From 0tomi/skills, MIT.

Signals

Stars
3
Forks
0
Open issues
0
Last commit (this folder)
Jul 11, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from 0tomi

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get sveltekit-tauri running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying sveltekit-tauri?

CallGet help
Cite this page

sveltekit-tauri skill. Agent Mart. https://agentmart.dev/skills/0tomi-sveltekit-tauri (last updated 2026-10-24)