0
0
Svelteframework~5 mins

Project setup with create-svelte

Choose your learning style9 modes available
Introduction

Setting up a new Svelte project quickly helps you start building web apps without hassle.

When you want to create a fresh Svelte app with recommended settings.
When you need a ready-to-use project structure for learning or development.
When you want to try Svelte features without manual setup.
When you want to start a new web project with modern tools and build scripts.
Syntax
Svelte
npm create svelte@latest my-app
cd my-app
npm install
npm run dev

npm create svelte@latest my-app creates a new folder named my-app with Svelte files.

After creation, you install dependencies and start the development server.

Examples
This creates a new Svelte project folder called my-first-svelte-app.
Svelte
npm create svelte@latest my-first-svelte-app
Navigate into the project, install packages, and start the app in development mode.
Svelte
cd my-first-svelte-app
npm install
npm run dev
Sample Program

This sequence creates a new Svelte project named demo-app, installs all needed packages, and runs the development server so you can see your app in the browser.

Svelte
npm create svelte@latest demo-app
cd demo-app
npm install
npm run dev
OutputSuccess
Important Notes

Make sure you have Node.js installed before running these commands.

You can choose options like TypeScript or JavaScript during setup.

The development server reloads automatically when you save changes.

Summary

Use npm create svelte@latest to quickly start a new Svelte project.

Install dependencies with npm install and run the app with npm run dev.

This setup gives you a ready environment to build and test Svelte apps easily.