rphlmr / supa-fly-stack

The Remix Stack for deploying to Fly with Supabase, authentication, testing, linting, formatting, etc.
MIT License
289 stars 26 forks source link

feat: add Supabase RLS demo #33

Closed rphlmr closed 1 year ago

rphlmr commented 1 year ago

This PR shows Supabase RLS server side with Remix world 🚀 By design, RLS is useful for client side code when you don't have backend / API. Since Supabase's team add a way to link an access token to supabase client, It opens possibilities :D

It can replace all Prisma stuff if you want, but you'll have to handle your DB schema with supabase cli or manually. Actual DB schema in this stack (made with and for Prisma) is not perfect to use only supabase sdk : I add some UID casts to match Prisma schema is RLS policies, some table column could have default value, etc...

Because this stack relies on Prisma first, I can't / don't want to remove it.

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