npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fsodano/vite-plugin-svelte-devtools

v0.2.2

Published

Svelte 5 and SvelteKit DevTools for Vite: component inspection, state replay, fetch mocks, server and SQLite traces, and MCP support

Downloads

394

Readme

Svelte DevTools

See what your Svelte app is doing. Give your agent the same view.

Inspect live component instances, edit state, replay snapshots, and follow requests into SQLite. Svelte DevTools runs in the Vite DevTools dock during development, with no browser extension to install.

Svelte DevTools component inspection

  • Inspect individual component instances, props, state, and parent relationships. Open the selected source in your editor.
  • Edit writable JSON state and undo or redo recorded changes.
  • Create browser fetch mock rules from captured requests.
  • Follow SvelteKit request, fetch, and explicit SQLite spans with measured durations and parent relationships.
  • Connect an agent through nine MCP tools, including acknowledged state edits in a selected live session.
  • Resize detail panes and choose theme, text size, and motion settings.

Independent community project. Early development; APIs may change. Requires Svelte 5.20+, Vite 8, and a supported Node.js release. Use Node.js 22.12+ for the documented workflow. The tested Vite DevTools host is 0.4.8; Chromium is the tested browser.

Install

For an existing Vite + Svelte project:

npm install -D @fsodano/[email protected] @vitejs/[email protected]
npx svelte-devtools init
npm run dev

Run these commands in your application directory. The setup command adds the host and plugin to your Vite configuration. For SvelteKit, it also creates a development-only server hook. It preserves existing adapter and compiler options, including those generated by the current Svelte CLI. You do not need to build the DevTools packages.

Use npx svelte-devtools init --dry-run to preview the edits. Repeating setup does not duplicate them. If your config is dynamic or your server hook already contains application logic, the command leaves the files unchanged and points to the manual instructions.

Manual configuration

Skip this section if you ran npx svelte-devtools init. The project also needs its normal Svelte compiler integration. For plain Vite, use @sveltejs/vite-plugin-svelte@^7 with Svelte 5 and Vite 8. SvelteKit projects use their existing sveltekit() integration.

// vite.config.ts
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { DevTools } from '@vitejs/devtools';
import { svelteDevTools } from '@fsodano/vite-plugin-svelte-devtools';

export default defineConfig({
  plugins: [DevTools(), svelte(), svelteDevTools()]
});

Start the application, open the Vite dock, enter the terminal's six-digit devframe authorization code, and select Svelte.

SvelteKit

Keep the generated sveltekit(...) call and all its options. Add DevTools() before it and svelteDevTools() after it. Import those two functions as shown above. Add the development hook:

// src/hooks.server.ts
import { dev } from '$app/environment';
import type { Handle } from '@sveltejs/kit';
import { svelteDevToolsHandle, noopHandle } from '@fsodano/vite-plugin-svelte-devtools/sveltekit';

export const handle: Handle = dev ? svelteDevToolsHandle() : noopHandle();

If you already have a handle, compose it with SvelteKit's sequence helper. Keep the development guard. See server integration.

Connect an agent

Start your app with a local API token:

export SVELTE_DEVTOOLS_TOKEN=replace-with-your-local-token
npm run dev

Keep the authorized Svelte panel open. Configure an MCP-compatible client with the same token and the actual app URL:

{
  "mcpServers": {
    "svelte-devtools": {
      "command": "npx",
      "args": ["-y", "@fsodano/[email protected]"],
      "env": {
        "SVELTE_DEVTOOLS_URL": "http://localhost:5173",
        "SVELTE_DEVTOOLS_TOKEN": "replace-with-your-local-token"
      }
    }
  }
}

Ask your agent to call svelte_status, select a live session, discover component IDs with svelte_components, and inspect the target instance before editing it with svelte_set_state. The other tools expose timeline events, snapshot metadata, routes, migration analysis, source, and server events.

Runtime reads reject missing or stale caches. State edits require a specific live session and acknowledge the actual setter. If an edit reports OUTCOME_UNKNOWN, inspect before retrying. The API token is separate from dock authorization. Do not commit real tokens. See MCP setup and limits.

Trace a SQLite operation

Wrap an actual synchronous call in server code:

import { dev } from '$app/environment';
import { traceSqliteQuery } from '@fsodano/vite-plugin-svelte-devtools/sqlite';

const statement = db.prepare('SELECT * FROM todos WHERE id = @id');
const todo = traceSqliteQuery({
  enabled: dev,
  database: 'todos',
  operation: 'get',
  statement: statement.source,
  captureStatement: true
}, () => statement.get({ id }));

Inspect the resulting span in Network's SQL filter, through HTTP, or with svelte_server_events. The native return value or error passes through unchanged. Statement capture is opt-in and limited to 4,096 characters. Bindings and result rows are omitted. Use safe templates: literal SQL can still contain sensitive values.

The wrapper requires an active traced request and measures synchronous execution. It does not automatically trace transactions, lazy iterators, or asynchronous database calls. State time travel does not roll back database writes. Browser fetch mocks do not affect SQL, server fetch, or XMLHttpRequest.

Save a Todo and follow the request into SQLite

Actual Todo save, SSR POST request, executed INSERT, and measured per-span timings. Detailed screenshot.

Examples and contribution

The repository ships plain Svelte, SvelteKit, a SQLite todo app, and a Pokédex.

See the project README, developer guide, and agent workflows. The panel is served from built assets; contributors must rebuild it after source edits.

MIT licensed.