How to install and create project in Svelte


Svelte is a frontend framework which is used to build fast applications. But it is used for creating a single page app without navigation. In this article we will learn quickly how to install and create a project in Svelte.

Installing Node

First of all you need latest version of node. For all javascript frameworks like React, Vuejs, Svelte etc., we need nodejs. If you already have one then jump to next section otherwise use this link to download –

Installing Svelte

After downloading Nodejs, we are ready for Svelte. Open command prompt and move to the directory where you want to create the project. Then use this command –

npx degit sveltejs/template my-project-name

Change my-project-name with the name of your project.

Let the process complete and then move to the project folder using this command –

cd my-project-name

Again change my-project-name with your project name.

It’s time to install all the dependencies listed in package.json file. Use the below command –

npm install

This will take a while. After it gets completed, you will have a well setup project.

In order to run it, use this command –

npm run dev

It will provide you a localhost url with port. The default url for Svelte is – http://localhost:5000

Now you can move on with the development.

When you are ready to publish your web app, you can make the production build with this command –

npm run build

    Tweet this to help others

Next Article

Directories and Files Structure of Svelte Projects