Project & Tooling
Scaffolding with the sv CLI
Section titled “Scaffolding with the sv CLI”The current way to start a Svelte or SvelteKit project is the sv CLI. One command scaffolds the project and can add integrations (TypeScript, Prettier, ESLint, Tailwind, testing) interactively:
npx sv create my-appcd my-appnpm installnpm run devsv create replaced the older npm create svelte@latest flow. It sets up a SvelteKit project by default (the recommended way to build Svelte apps), wires up Vite, and lets you opt into add-ons up front. There’s also npx sv add <name> to add an integration to an existing project later.
Vite drives everything
Section titled “Vite drives everything”A Svelte project runs on Vite. In development, Vite serves your modules over native ESM with hot module replacement — edit a component and the change appears without a full reload, preserving state where possible. For production, vite build bundles and optimizes the output.
{ "scripts": { "dev": "vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json" }}The Svelte integration for Vite (@sveltejs/vite-plugin-svelte, wired up for you by sv create) is what runs the compiler on your .svelte files during dev and build. You rarely touch it directly.
flowchart LR code["your .svelte / .ts files"] --> vite["Vite + svelte plugin"] vite --> dev["dev: HMR server"] vite --> build["build: compiled, bundled output"]
Editor support and svelte-check
Section titled “Editor support and svelte-check”Two tools keep the authoring experience honest:
- The Svelte editor extension (official, for VS Code and others) gives syntax highlighting, autocompletion, and inline diagnostics for
.sveltefiles — including type errors inside the markup, not just the script. svelte-checkis the command-line equivalent: it type-checks and lints your whole project, including expressions in templates, so you catch errors in CI that the editor would show you locally.
npm run check # runs svelte-check across the projectBecause svelte-check understands .svelte files end to end, it catches mistakes a plain tsc would miss — a wrong prop type passed in markup, a typo in a template expression, an unused CSS selector. Prettier and ESLint (with their Svelte plugins, offered by sv create) round out formatting and linting.