Sveltejs Academy · Lesson

Creating a Project with npm create svelte

Scaffold a new SvelteKit project using the official CLI and choose the right options.

Lesson 2 of 413 steps

Creating a Project with npm create svelte is a free Sveltejs Academy lesson on CoddyKit. This is lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Sveltejs Academy learning path, and your progress syncs across the web and the CoddyKit app. The Sveltejs Academy course includes 4 lessons in total.

Scaffolding Tool

The official way to start a SvelteKit project is the npm create svelte@latest command. It generates a ready-to-run app.

npm create svelte@latest my-app

The Wizard Asks

You will be prompted for a template (skeleton, demo app), TypeScript support, and tooling (ESLint, Prettier, Playwright, Vitest).

Template Choices

The Skeleton project gives the minimal layout. The Demo app includes a small Sverdle game example to study.

TypeScript Option

Choose Yes for TypeScript if you want type safety. The wizard wires up TS config and uses lang="ts" in script blocks.

Install Dependencies

After the wizard finishes, change directory and install packages.

cd my-app
npm install

Start the Dev Server

Use the dev script to launch a hot-reloading server at http://localhost:5173.

npm run dev

Open in Browser

Visit the URL printed in the terminal. You should see a welcome page. Edit src/routes/+page.svelte and watch it update live.

Production Build

The build script runs the compiler and produces an output directory ready to serve.

npm run build
npm run preview

Choosing a Package Manager

You can use npm, pnpm, or yarn. pnpm is popular for its disk efficiency and strict resolution.

Editor Setup

Install the Svelte for VS Code extension for syntax highlighting, IntelliSense, and diagnostics in .svelte files.

Git Init Optional

The wizard offers to initialize a git repository. Saying yes adds a sensible .gitignore file.

Quick Check

Which command creates a new SvelteKit project?

Recap

You can now scaffold a project, pick TypeScript and tooling, install dependencies, and run dev or build scripts.

Free to start

Learn HTML with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
41
Lessons
163

Frequently Asked Questions

Is the “Creating a Project with npm create svelte” lesson free?

Yes — the full text of “Creating a Project with npm create svelte” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Sveltejs Academy course, upgrade to CoddyKit PRO. The Sveltejs Academy course includes 4 lessons in total.

What will I learn in “Creating a Project with npm create svelte”?

Scaffold a new SvelteKit project using the official CLI and choose the right options. You practise Sveltejs Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Sveltejs Academy?

No prior experience is required. Sveltejs Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 4.

How long does the “Creating a Project with npm create svelte” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Sveltejs Academy lesson?

Yes. Every Sveltejs Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is Svelte and Why It Compiles
  2. Creating a Project with npm create svelte
  3. Project Structure: src routes static
  4. The Dev Server and Hot Module Replacement
← Back to Sveltejs Academy