Why I Chose Nuxt over Sveltekit?
Intro
This year I decided to rebuild my website from Sveltekit to Nuxt. Now I enjoy Sveltekit, I have built many projects with it and I enjoy the developer experience, however I wanted to try something new. The frameworks that came to mind was between SolidStart or Nuxt. I chose Nuxt because although Solid start recently hit v1 Nuxt has been around longer so it has a larger eco system. I also have not used Vue since Vue 2 and with the new Composition API and better TypeScript support in Vue 3 I would like to give it another try.
What I liked over Sveltekit
After rebuilding my website in Nuxt here's what I liked over Sveltekit.
- Auto imports
- This is a great DX especially coming from Sveltekit where you have to import everything. Often times I have 10-20 lines of import statements. This makes the file so much cleanier not having to import anything. It feels like magic.
- Modules
- Modules make it easy to integrate packages into your app and also help hide additional clutter such as the tailwind config file and the postcss file which is required by tailwind.
- They have many modules here's some modules I used
- A lot of these modules are zero config out of the box. So you just install them using nuxi and don't have to do anything else.
- Nuxt config file
- Now I haven't seen any other framework do this but Nuxt basically takes all the 3rd party configs e.g tailwind, nuxt content, tsconfig, sitemap and allows you to change all that in 1 file "nuxt.config.ts" instead of having seperate config files. I really enjoy this because then you don't need all these config files in your workspace.
- Deployment
- Now I knew I wanted to deploy my website to Cloudflare. I've been using Netlify and wanted to try something new. I found out that there's a service called Nuxt Hub which does exactly that with zero configuration. I was able to deploy my site to Cloudflare didn't run into any issues it was so seamless. I will definitely be using this service for future projects.
- Eco system
- Now Svelte is definitely growing but the Nuxt eco system has just about everything. This is huge especially if you want to get projects done quickly. When I worked in Svelte I often found myself re-creating things from scratch such as a "Teleport" or "Portal" what they call it in the React world. However Nuxt already has a utility for that. Oh I want a markdown parser for my site, well Nuxt has Nuxt Content. Svelte? Well I have to go look around for a decent library and it's not as seamless as Nuxt Content is.
Conclusion
I'm very happy I chose Nuxt to rewrite my website in. I like it so much that I think I'll actually start using Nuxt over Svelte for future projects. Oh and I was also able to achieve a perfect lighthouse score.