Skip to content

jodator/supabase-playground

Repository files navigation

🤓 Example Next.js app with Supbase

Live preview 💁‍♂️ Orders lists

🚛 Deploy your own

Deploy with Vercel

This repo requires Supabase integration enabled in Vercel.

🧑‍💻 How to hack

Install dependencies using PNPM (or any other package manager)

pnpm i

Use standard Next.js scripts:

pnpm dev

On blank Supabase project you'd need to run Prisma migration to start:

pnpx prisma migrate dev --name item --skip-generate

A missing step in Prisma setup is to create a auth.users view with schema. Without this view you can't read from internal auth.users table. For now, you can execute this in supabase dashboard:

create view users as select * from auth.users

Then you're good to sync the supabase types:

pnpx supabase gen types typescript --linked > database.types.ts

📝 Notes

If you reset the Supabase DB using Prisma you'd need to bring back default privileges:

grant usage on schema public to postgres, anon, authenticated, service_role;

grant all privileges on all tables in schema public to postgres, anon, authenticated, service_role;
grant all privileges on all functions in schema public to postgres, anon, authenticated, service_role;
grant all privileges on all sequences in schema public to postgres, anon, authenticated, service_role;

alter default privileges in schema public grant all on tables to postgres, anon, authenticated, service_role;
alter default privileges in schema public grant all on functions to postgres, anon, authenticated, service_role;
alter default privileges in schema public grant all on sequences to postgres, anon, authenticated, service_role;