T
TanStack3w ago
extended-salmon

What is the benefit of using an `electricCollection` over an `queryCollection`

In the documentation, this point is not very clear
8 Replies
wise-white
wise-white3w ago
They're different ways of loading data. Query collection lets you load data from your API, electric let's you sync data from postgres You might have noticed there's a number of other collection types as well That work with other sync engines
extended-salmon
extended-salmonOP3w ago
Yep! I am now creating an app from scratch, using supabase as the backend. After initial research, I figured out that ElectricSQL and supabase play nice. Now I am thinking of just using the queryCollection with supabase api's (don't need to manage auth for the electricsql server then) What's you rake on this decision? am I on the right track, in terms of simplification?
wise-white
wise-white3w ago
Either can work. A nice benefit is it's not hard to switch back and forth It depends what benefits you want and where you want to put effort
extended-salmon
extended-salmonOP3w ago
thank you kyle :) i'll be using tanstack query so i don't need to worry about putting an electricsql server behind a proxy and auth'ing that proxy.
wise-white
wise-white3w ago
Ok cool. Are you creating an API that query supabase with or using RLS?
extended-salmon
extended-salmonOP3w ago
I am querying supabase with probably supabase auth based security
wise-white
wise-white3w ago
ok so no plans for an API — yeah a "proxy" is just an API but if you're trying to avoid an API altogether than it'd be easier to skip
extended-salmon
extended-salmonOP3w ago
ah, i see where you are going. yes i am using the supabse client, therefore no api in the traditional http requests sense, although thats whats happening in the background thanks for the help kyle! i am makig fast progress hehe

Did you find this page helpful?