DEV Community

Anzhari Purnomo
Anzhari Purnomo

Posted on

Pitch to me: why should I use Svelte?

I've been using Vue (Vue2 and Vue3) for several years, and now I keep hearing how great Svelte is. I looked at their quickstart guide, and it seems cool. I'd like to hear from people already using Svelte, probably on commercial/production environment. Much better if you can share the link, so I can take a look at your product.
Looking forward to your input.
Thanks!

Discussion (15)

Collapse
kevinpeckham profile image
Kevin Peckham

Svelte is a breeze to learn coming from a Vue background. And I find almost everything to be easier and faster about it.

I’ve been using it for about a year.

Here’s a fairly simple website I built recently using Svelte, Sveltekit, Typescript, Pug and GraphCMS. zenithterminals.com

I haven’t used it for anything more complicated yet. But looking forward to doing so soon.

Collapse
anzhari profile image
Anzhari Purnomo Author

Thanks for the answer! Considering Svelte is relatively new, do you have any difficulties when trying to find modules/plugins?

Collapse
kevinpeckham profile image
Kevin Peckham

I didn’t have any trouble.

I did look for a plug-in that allowed me to use Pug, which I found and it worked well. Otherwise I stuck pretty close to Sveltekit defaults.

I should also mention I used TailwindCSS and configuration was straightforward following their instructions.

I also staged and deployed with Vercel which was almost disturbingly easy.

Collapse
jesperhoy profile image
Jesper Høy

I moved from Vue.js (v. 2) to Svelte about a year ago.
I wrote a blog post comparing the two at jesperhoy.com/p55/svelte-vs-vue-js
I have incorporated Svelte into a few larger commercial projects.
For example, the page geografi.tjek.net/opgaver is a small Svelte SPA showing groups and lists of exercises (in Danish - for schools in Denmark).
Unfortunately most of my Svelte work is behind logins, so not much else to show.

Coming from Vue, Svelte was very easy to pick up, and now I much prefer the Svelte template syntax and coding style.
Svelte is more performant and bundle size is smaller (at least for small to medium sized projects).

The only thing that I don't like about Svelte, is that it requires build tools.
Even for the smallest widget on a server rendered webpage - you have to get everything setup with node, npm, etc.
Lately, I have been looking into Mithril and Lit-html for exactly this reason - tiny frameworks that work both with and without build tools. I might move on to something like that - just so that I can use one tool for everything.

Collapse
anzhari profile image
Anzhari Purnomo Author

I read your blog. The one caught my eyes were the cleaner syntax (without the this keyword) in favor of Svelte and the the deep reactivity in favor of Vue.
Also, I checked your sample page. I noticed that the Lighthouse score is very nice.
Thanks for sharing!

Collapse
errorcode0 profile image
ErrorCode0

Simple to use, easy to learn and has good docs. If you are thinking of building a full web app with a backend and routing etc then you should try looking at sveltekit. It is good but is still in beta as of now.

Collapse
anzhari profile image
Anzhari Purnomo Author

Thanks for the answer! Did you have a chance to try sveltekit? Is it relatively stable (even though still in beta)?

Collapse
errorcode0 profile image
ErrorCode0

Yeah I started working on an app and it was relatively smooth and nice to get up and running.

Collapse
deozza profile image
Edenn Touitou

Moved from Nuxtjs (Vuejs framewok) to Sveltekit (Svelte framework) about a year ago.

First what impressed me was the syntax. There is none. You are writing near pure JS/TS code. There is very few syntax sugar, structures of functions you must follow, ... So reading, learning and writing code is easy.

The templating is like every modern JS framework : a general layout + a page for custom stuff depending on...well...the page you are on + components for small reusable parts.

Then the fact that it can be built directly for various hosts systems. Vercel, Netlify, Firebase, Cloudflare, Azure... And all the build is automated. You only have to drop the folder in the host.

There is also the fact in can do SPA, SSR, static sites, ... And paired with the correct adapter, it separates by itself the static part from the server part. For example, I wrote SSR websites and host them on Netlify. Once the build is done with the Netlify adapter, I end with a folder with static resources and a folder dedicated to Netlify functions.

As Svelte is a compiler rather than a real framewok, the built project is very small. Thus fast to load. And the compiler helps you before commiting code with errors or bad practice.

Finally, if you want to write NPM packages, Svelte has a command handling that.

You can find one of my project here : appquarium.fr/ , with its repo . The stack is Sveltekit + GraphQL (Hasura backend) + Tailwind + Firebase Auth, Firestore and Storage.

Collapse
anzhari profile image
Anzhari Purnomo Author

I see that the cleaner syntax is a big plus for many people. I admit sometimes Vue's store, this, and event are kinda annoying. Also setting up the TypeScript project is kinda tiring.
I checked your app on Lighthouse, and it performs really well!
Thanks for sharing!

Collapse
nombrekeff profile image
Keff

Minimal boilerplate, simple templating, really easy to get going, performant.

Collapse
anzhari profile image
Anzhari Purnomo Author

Thanks for the answer! What framework did you use before Svelte? Did you feel noticeable performance gain?

Collapse
nombrekeff profile image
Keff

I've used quite a few, but have the most experience with angular, but comparing angular to svelte is weird xD of course svelte feels more performant, though it could very well be. Nonetheless it feels a lot faster, but as I said they are not comparable hahaha

Collapse
p3ntest profile image
Julius (P3ntest)

Intuitive reactivity

Collapse
anzhari profile image
Anzhari Purnomo Author

Thanks for the answer! What framework did you use before Svelte?