What's the Next.js support?

What's the Next.js support? https://github.com/rivet-gg/rivetkit/issues/ I would like to use persistent storage and real-time capabilities, but I couldn't find any information on how to run actors inside Next.js. It appears that I will need to create a separate server and share the business logic.
GitHub
rivet-gg/rivetkit
🧰 The open-source alternative to Durable Objects. Easily self-hostable and works with your infrastructure. - rivet-gg/rivetkit
6 Replies
Nathan
Nathan5mo ago
We haven't published docs on this yet, but it is supported. Specifically – Next.js doesn't support WebSockets, but we do support SSE transport. You can mount RivetKit under the api folder
Carlos
CarlosOP5mo ago
Most people use Socket.io (their custom implementation) or Pusher-compatible alternatives (Soketi, Sockudo, etc.). I do too, for most implementations, but I'm facing a new challenge while building a Sync Engine to use within PayloadCMS, and I've found RivetKit to be a great choice as an internal library to persist active query subscriptions, and leveraging real-time capabilities out of the box. Currently, I have it implemented with Redis (to persist the subscriptions) and Sockudo (for the real-time part).
Nathan
Nathan5mo ago
Glad to hear, that's the goal! Aside from mounting in api – is there anything with Rivet that's a rough experience/causing issues with your setup? We're still trying to round out as many edges as possible.
Carlos
CarlosOP5mo ago
I managed to get it working. This is the repo: https://github.com/carlosbensant/payload-sync Since we have reactive queries (like Convex), Rivet essentially helps next.js to persist active query subscriptions after a server restart.
GitHub
GitHub - carlosbensant/payload-sync: A real-time sync plugin for Pa...
A real-time sync plugin for PayloadCMS that provides reactive queries (like Convex) and optimistic mutations. - carlosbensant/payload-sync
Nathan
Nathan5mo ago
sweet! doesn't seem like the rivet part is merged yet?
Carlos
CarlosOP5mo ago
It is: https://github.com/carlosbensant/payload-sync/blob/main/src/plugins/payload-sync/src/actors/subscriptions.ts - I need to create the Payload-Sync package. - Make some adjustments related to SSE and optimistic updates
GitHub
payload-sync/src/plugins/payload-sync/src/actors/subscriptions.ts a...
A real-time sync plugin for PayloadCMS that provides reactive queries (like Convex) and optimistic mutations. - carlosbensant/payload-sync

Did you find this page helpful?

What's the Next.js support? - Rivet Developer Network