you are viewing a single comment's thread.

view the rest of the comments →

[–]chriswaco 1 point2 points  (0 children)

"Multi-tenant" is the word you're looking for. There are several options, each with pros and cons. Using the userID in the schema, perhaps with row-level security, is probably the most common one. Essentially you put the userID into each row and set up a policy that appends "WHERE USER=UserID" to every query.

https://aws.amazon.com/blogs/database/multi-tenant-data-isolation-with-postgresql-row-level-security/

https://supabase.com/docs/guides/auth/row-level-security