0
0
Svelteframework~10 mins

Project setup with create-svelte - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Project setup with create-svelte
Run 'npm create svelte@latest'
Choose project name
Select template (Skeleton, Demo, etc.)
Install dependencies with 'npm install'
Run development server with 'npm run dev'
Open browser to localhost:5173
See Svelte app running
This flow shows the steps to create a new Svelte project using create-svelte, install dependencies, and run the app.
Execution Sample
Svelte
npm create svelte@latest my-app
cd my-app
npm install
npm run dev
This sequence creates a new Svelte project folder, installs needed packages, and starts the development server.
Execution Table
StepCommand/ActionSystem ResponseResult
1npm create svelte@latest my-appPrompts for template and optionsCreates 'my-app' folder with Svelte files
2cd my-appChanges directory to project folderReady to run commands inside 'my-app'
3npm installDownloads and installs dependenciesnode_modules folder created with packages
4npm run devStarts development serverServer runs at http://localhost:5173
5Open browser at localhost:5173Browser loads appSvelte starter app visible
6ExitStop server with Ctrl+CDevelopment session ends
💡 Development server stopped by user; project setup complete
Variable Tracker
VariableStartAfter Step 1After Step 3After Step 4Final
projectFoldernonemy-app createdmy-app with dependencies installedmy-app running dev servermy-app ready for development
serverStatusstoppedstoppedstoppedrunningstopped
Key Moments - 3 Insights
Why do we need to run 'npm install' after creating the project?
Because 'npm create svelte@latest' only sets up files, but dependencies like Svelte itself are installed only after 'npm install' (see execution_table step 3).
What happens if you try to run 'npm run dev' before 'npm install'?
The server won't start because required packages are missing. The execution_table shows 'npm install' must run first (step 3) before 'npm run dev' (step 4).
How do you know the development server is running?
The command 'npm run dev' outputs the local URL (http://localhost:5173), and opening it in a browser shows the Svelte app (execution_table step 5).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the system response after running 'npm create svelte@latest my-app'?
ADownloads and installs dependencies
BStarts development server
CPrompts for template and options
DChanges directory to project folder
💡 Hint
Check execution_table row 1 under 'System Response'
At which step does the development server start running?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Look at execution_table 'Command/Action' and 'Result' columns
If you skip 'npm install', what will happen when you run 'npm run dev'?
AThe server will fail to start due to missing packages
BThe server will start normally
CThe project folder will be deleted
DThe browser will open automatically
💡 Hint
Refer to key_moments about the importance of 'npm install'
Concept Snapshot
Project setup with create-svelte:
1. Run 'npm create svelte@latest <project-name>' to scaffold.
2. Choose template and options when prompted.
3. Change into project folder with 'cd'.
4. Run 'npm install' to get dependencies.
5. Start dev server with 'npm run dev'.
6. Open browser at localhost:5173 to see app.
Full Transcript
To set up a new Svelte project, you start by running 'npm create svelte@latest' followed by your project name. This command scaffolds the project files and asks you to pick a template. Next, you move into the project folder using 'cd'. Before running the app, you must install dependencies with 'npm install'. After installation, you start the development server with 'npm run dev'. Finally, you open your browser to http://localhost:5173 to see the running Svelte app. Stopping the server ends your development session.