DEV Community

Cover image for Getting Started with Svelte JS
Naya Willis
Naya Willis

Posted on

2 2

Getting Started with Svelte JS

So I've been skimming through some Svelte documentation recently and from what I've been reading it seems to be earning my heart. The ease of use and implementation is all a developer can ask for. This short blog will mostly be about starting and setting up a Svelte application. For this I'll be using VSCode.

What is Svelte?

"Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app.

Instead of using techniques like virtual DOM diffing, Svelte writes code that surgically updates the DOM when the state of your app changes."

  • The website

Step 1:

Open VSCode and create the necessary folder where you will be housing your project.

Step 2:

Go into your terminal and cd into that folder that you created.

Step 3:

Run the command

> npx degit sveltejs/template app-name

This will auto generate some files and folders for you. Similar to how React would.

Step 4:

After you run that command it will generate a folder with your app name. Cd into that folder then run

> npm install

This will install all of the necessary dependencies. You should see a package-lock.json appear in your directory.

Alt Text

Step 5:

Lastly, run the command...

> npm run dev

This will start a server running on PORT 5000 (http://localhost:5000). Happy coding!

======================================================

Part 2: Building a Booklist Application using Svelte

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️