Reputation: 25
Currently building a calendar/schedulling tool using Next.js, Prisma and a Supabase Postgres db and I want to be able to access live data from Supabase so that new events are automatically added to the calendar.
I tried the Prisma Subscription solution and this works in development, however it's mentioned on their GitHub that there are scalability issues when used in production which are unlikely to be resolved in V1. Source
I can see that Supabase also has a RealTime solution, however I would prefer not to undo all the work that has already been done using Prisma.
Is it possible to use Supabase RealTime for some aspects (like retrieving new events) and then use Prisma for others (such as creating new events)? And if so, are there any limitations that need to be taken into account (e.g. prisma scalability issues)?
Upvotes: 0
Views: 343
Reputation: 18603
You can certainly just use the realtime features of Supabase just by installing the Supabase npm package on your client application!
supabase
.channel('*')
.on('postgres_changes', { event: '*', schema: 'public', table: 'my_table' }, payload => {
console.log('Change received!', payload)
})
.subscribe()
Upvotes: 1