Hi Redwood, meet Supabase.io, Supabase adds realtime and RESTful APIs to your existing PostgreSQL database without a single line of code.
Supabase.io has superpowers and could easily replace Prisma2
Benefits:
-
Many systems that give you realtime functionality require you to update via the same interface that the listener is on. Supabase is source agnostic. Update your database from anywhere and youāll still get the changes.
-
Scale the realtime servers without putting any additional load on your DB. All you need is one connection to your database, and you can handle thousands (or millions) or users
-
Listening to data changes on client side solves stale data problems and update collisions.
In implementing subscription for RedwoodJS, which could be a win for RedwoodJS instead of waiting for Prisma2 to implement subscription, I think we should take a look at how Supabase.io achieved real-time/reactivity with Postgres using its real-time feature with examples showing how it works with NextJS. Supabase is a service that introspect your database to give you instant, custom documentation for your REST and Realtime APIs. Supabase Realtime, built with Elixir, listens to your to PostgreSQL database in realtime via websocket. My team already worked with Supabase Realtime in the past and were able to get subscription working with NextJS using the open source Realtime Docker image provided by Supabase to listen to Postgres NOTIFY.
At its core, Supabase is an Elixir server that allows you to listen to PostgreSQL inserts, updates, and deletes using websockets. Supabase listens to Postgresā built-in replication functionality, converts the replication byte stream into JSON, then broadcasts the JSON over websockets.
Listen to your Prisma Postgres tables by following instructions here Supabase Javascript Client - Subscribe to channel