SvelteKit + Supabase. It’s the opposite of what a lot of people recommend. It’s not battle tested. Both of these technologies are still maturing BUT: I can write everything in JS/TS, I don’t have to get good at Ruby PHP or Python Postgres is a great skill to learn. Supabase is portable and can be self hosted, and its JS client is easy to use for DB manipulation and stuff like object storage. For me, building a true f…
So I’m fairly new to the world of full stack web development. I’ve been trying to make an MVP using SvelteKit and Firebase, but what I’m running into is that they both kind of try and avoid a separate backend in different ways that seem to sometimes conflict with each other. For instance, Firebase is meant to connect on the client so you don’t need the backend database connection, but then you can’t use SvelteKit’s S…
In Node, a “module” is generally scoped to a file. So you make a db.ts file and export the instance you create and it functions basically as a singleton. One DB connection per user per session. SvelteKit let’s you choose where to put that. The first place you import it is when it instantiates.
Auth in SvelteKit is trickier than it should be, but there’s a really good technique that I recommend you follow: https://www.captaincodeman.com/re-creating-the-sveltekit-ses...
I believe he uses firebase in his example. But don’t just copy paste, try to understand what is actually happening and why he had to do this workaround. Once you understand how SSR actually works, things get a lot easier.
Stores are a way of storing state on the client side, but to do SSR Svelte has to use stores on its “backend”. The key thing to understand is that stores that are used for SSR are server wide and persistent so you can’t store user specific data in them. There’s a special spot for that kind of state called events.locals.
It’s probably the trickiest area of SvelteKit IMO. I hope they make it better.