This is the developer documentation for Svelte CLI. # Overview The command line interface (CLI), `sv`, is a toolkit for creating and maintaining Svelte applications. ## Usage ```sh npx sv ``` ## Commands - [`sv create`](sv-create) — scaffold a new Sveltekit project, with the option to set up add-ons in one go - [`sv add`](sv-add) — apply add-ons to an existing project - [`sv migrate`](sv-migrate) — migrate your Svelte(Kit) codebase between versions - [`sv check`](sv-check) — analyze your code with [svelte-check](https://github.com/sveltejs/language-tools) Run `sv --help` to see all options for a command. ## Add-ons An add-on is a pre-packaged integration that applies itself to your project: it installs dependencies, writes config files, and may ask follow-up questions (like which database to use). There are two types: - **Official add-ons** are developed and maintained in the [Svelte CLI repository](https://github.com/sveltejs/cli) by the Svelte team, and have been vetted for both quality and safety. They're a deliberately small set of widely used, best-in-class integrations. See the [full list of official add-ons](sv-add#Official-add-ons). - **Community add-ons** are npm packages published by the community, letting any library or tool become a one-liner install with `npx sv add my-addon`. Svelte maintainers have not reviewed them for malicious code — see the [community add-ons docs](sv-add#Community-add-ons) for how to find and install them. Want to make your own add-on? Follow the [create your own guide](community). ## Acknowledgements Thank you to [Christopher Brown](https://github.com/chbrown) who originally owned the `sv` name on npm for graciously allowing it to be used for the Svelte CLI. You can find the original `sv` package at [`@chbrown/sv`](https://www.npmjs.com/package/@chbrown/sv). # Frequently asked questions ## How do I run the `sv` CLI? Running `sv` looks slightly different for each package manager. Here is a list of the most common commands: - **npm** : `npx sv create` - **pnpm** : `pnpm dlx sv create` - **Bun** : `bunx sv create` - **Deno** : `deno run npm:sv create` - **Yarn** : `yarn dlx sv create` ## `npx sv` is not working Some package managers prefer to run locally installed tools instead of downloading and executing packages from the registry. This issue mostly occurs with `npm` and `yarn`. This usually results in an error message or looks like the command you were trying to execute did not do anything. Here is a list of issues with possible solutions that users have encountered in the past: - [`npx sv` create does nothing](https://github.com/sveltejs/cli/issues/472) - [`sv` command name collides with `runit`](https://github.com/sveltejs/cli/issues/259) - [`sv` in windows powershell conflicts with `Set-Variable`](https://github.com/sveltejs/cli/issues/317) ## Why are there two packages, `sv` and `@sveltejs/sv-utils`? They have a clear boundary: - [`sv`](sv) decides **where and when**: paths, workspace detection, dependencies and file I/O. - [`@sveltejs/sv-utils`](sv-utils) decides **what** to do to content: parsers and pure transforms, with no file system or workspace awareness. This keeps transforms testable without a workspace and composable across add-ons. ## Should my add-on bundle `@sveltejs/sv-utils`? Most breaking changes land in `@sveltejs/sv-utils`, not `sv`. Each `sv` release ships one exact `@sveltejs/sv-utils` version, so you have two options: - **Bundled** (template default): pins the version you tested against. Safest, costs ~1 MB. - **Unbundled**: declare it in `peerDependencies`. Your add-on stays tiny and runs against the copy `sv` ships. When majors differ, `sv` warns and prints the command to rerun with the `sv` you built for: `npx sv@ add `. If an unbundled add-on breaks for your users, they can run that command, and you can publish a fix for the latest `sv`. See [bundling](community#Publishing-Bundling). # sv create `sv create` sets up a new SvelteKit project, with options to [setup additional functionality](sv-add#Official-add-ons). ## Usage ```sh npx sv create [options] [path] ``` ## Options ### `--from-playground ` Create a SvelteKit project from a [playground](/playground) URL. This downloads all playground files, detects external dependencies, and sets up a complete SvelteKit project structure with everything ready to go. Example: ```sh npx sv create --from-playground="https://svelte.dev/playground/hello-world" ``` ### `--template ` Which project template to use: - `minimal` — barebones scaffolding for your new app - `demo` — showcase app with a word guessing game that works without JavaScript - `library` — template for a Svelte library, set up with `svelte-package` - `addon` — template for a community add-on, ready to be tested & published ### `--types