Is it wrong to create a lot of collections?

So I have a question about best practices when working with collections in WeWeb. Should I have only one collection per table?

Using collections is a convenient way to filter data, especially when filters are applied at the time the collection is created. Here’s my scenario:

I have a collection called users that retrieves all users from the table — I’m not applying any filters to it, so it returns everything.

Now, I also have a user profile page where the authenticated user can view and edit their information. For this, I created a new collection called user_by_id, which pulls data from the same table, but with a filter applied: where id = auth.user.id so it brings only one user data.

Is this a bad practice in WeWeb? Or is it acceptable to have multiple collections from the same table with different filters, depending on the use case?

No I don’t think so, I’m doing this also for filtering or export matters. Would be curious to have another point of view

1 Like

Yes, most of the time that’s the best approach. I’m definitely sticking with it from now on — just organizing everything into folders for better structure like in the image

Depends. If you use 2-3 collection per view of your app, it’s pretty chill. If you do 7 collection for one view, that’s quite bad design. Also if you re-fetch collections after each change and experience huge latencies, that’s also bad design. I teach these things.

1 Like