top | item 35598250

(no title)

almostdigital | 2 years ago

SvelteKit's routing pattern is anything but clean. It uses filesystem based routes where every file is called "+page.svelte" (or +page.server.js/ts for API only routes).

For anything but a demo app with just a couple of routes it's a headache to navigate.

Edit: Another smell of the routing system to me is that you need to resort to complexity like this [1] to have anything but top down inheritance. I love Svelte btw and have used it in many projects.

[1] https://kit.svelte.dev/docs/advanced-routing#advanced-layout...

discuss

order

9dev|2 years ago

Having built a rather large app using SvelteKit, I found the routing scheme to make lots of sense actually. You always know what code is located where, concepts transfer everywhere consistently, and concerns are nicely separated.

almostdigital|2 years ago

In theory it seems neat but in practice I'm here with 10 tabs all called "+page.svelte" or "+page.server.ts" and it completely breaks my workflow since I can't tell them apart or navigate with fuzzy name matching. How do you deal with that?

kevinak|2 years ago

This.

It might look complicated at first sight, but once you actually use it you really appreciate the way it's structured.

pier25|2 years ago

I completely agree.

I've been using Svelte happily for years, but I won't be using SvelteKit. In part because of the routing but also because it doesn't really solve much in the backend.

It's amazing that all the full stack frameworks (Next, Nuxt, SvelteKit, Remix, Astro, etc) are investing so much effort into reinvent the backend and after years they still don't provide even basic backend functionality. For example, out of the box, Fastify gives you validation, sessions, CORS, cache headers, etc. Features that you need in probably all backend projects.

I started this repo to figure out how to integrate Svelte with Fastify using Vite. It has hot reload, partial hydration, etc. It's very quick and dirty code, but it works.

https://github.com/PierBover/fastify-vite-svelte-template

dncornholio|2 years ago

It's only a headache if you make it one. With an open mind, it looks pretty neat to be honest. The top down inheritance doesn't look complex, just weird.

himujjal|2 years ago

I agree with this comment. SvelteKit is unnecessarily complicated. The `+page.svelte` etc are just the start of it.

Plus I can't use it with Go, PHP, Ruby, Rust etc when it comes to SSR (without running multiple servers and handling deployment nightmares).

Something about this whole Node + SSR Front-end is smelly. (next, nuxt, solidstart) I love Svelte as a framework and a way of writing UI, but SvelteKit. Eh! Not so much.

SvelteKit is too much complexity for no reason. Goes opposite of what Svelte was meant to be: Simple and intuitive.

kevinak|2 years ago

Curious to hear more, what specifically is complicated about it?

SvelteKit is a JavaScript framework, it makes sense that you can't use it with other languages. You can pair it with a backend of your choice of course, but to get the SSR benefits you do need to work within the framework.

There are other ways of using Svelte with other languages, I would take a look at something like Inertia.js [0].

[0] https://inertiajs.com

KyeRussell|2 years ago

“SvelteKit is too complicated, it doesn’t even have this thing that would certainly make it more complicated!”