Skip to main content

Introducing the new Svelte CLI

Tailwind, auth, databases and more — just an npx sv away

We’ve just released sv, a new Command Line Interface (CLI) for creating, enhancing, and upgrading Svelte projects.

One of the most common question we hear is “how do I set up Tailwind on my new project?”. Tailwind has SvelteKit documentation, but it lists eight steps. While the community-led svelte-add project could automate the process, few knew about it.

Introducing sv at Svelte Summit Fall 2024

Now, we’re offering that functionality via our own CLI, directly within the project creation screen. And not just for Tailwind — we have built-in add-ons for formatting, linting, testing, setting up databases and auth and i18n and more. Just run npx sv create and follow the prompts:

$ npx sv create

┌  Welcome to the Svelte CLI! (v0.5.8)

◇  Where would you like your project to be created?
│  my-new-app

◇  Which template would you like?
│  SvelteKit minimal

◇  Add type checking with Typescript?
│  Yes, using Typescript syntax

◆  Project created

◆  What would you like to add to your project? (use arrow keys / space bar)
│  ◻ prettier (https://prettier.io)
│  ◻ eslint
│  ◻ vitest
│  ◻ playwright
│  ◻ tailwindcss
│  ◻ drizzle
│  ◻ lucia
│  ◻ mdsvex
│  ◻ paraglide
│  ◻ storybook

You can also run npx sv add to apply add-ons to existing projects. In the near future, we will also be supporting add-ons contributed by the community within sv. If you’re interested in building one, please subscribe to the issue in the CLI repository to be notified when third party add-ons are supported.

It doesn’t stop there. Over time, Svelte has accumulated a handful of CLIs: svelte-check type-checks your project from the command line, npx svelte-migrate helps you upgrade to new major versions, and in the future we might have even more capabilities. Remembering the package name of each tool is cumbersome, which is why we unify the experience under one roof, sv. That means you can now run sv migrate svelte-5 to upgrade your Svelte 4 projects to Svelte 5. (The migration functionality can also be found in Svelte for VS Code as well as in the playground.)

A huge thank you to Christopher Brown (chbrown) who donated the sv package name on npm to make this CLI possible. This package merges the previous create-svelte and community-led svelte-add tools into a single package. Thank you to Manuel (manuel3108) and Adrian (CokaKoala) who recently took over maintenance of the svelte-add project and have joined as the newest Svelte maintainers in making this project an official part of Svelte. Also thank you to J (babichjacob) for creating the svelte-add project and successfully stewarding it for years as an important part of the Svelte community.

To see the CLI in action, check out this demo from Ben Davis and t3.gg...

Introducing sv at Svelte Summit Fall 2024

...or run npx sv to try it out yourself.