Frontend & Clients
Next.js
The Rivet Next.js client allows you to connect to and interact with actors in Next.js applications.
View Example on GitHub
Check out the complete example
View the backend integration
Use Next.js API routes to run RivetKit Registry
Basic Usage
Installation
Install the RivetKit React package:
Setup RivetKit client
Follow the Next.js backend integration guide to set up your Next.js backend with Rivet.
Create a RivetKit client to connect to your actor:
src/lib/rivet-client.ts
It's important to use SSE (Server-Sent Events) for real-time updates in Next.js.
Connect to Actor
Connect to actors and listen for real-time updates:
src/components/Counter.tsx
Make sure to import the
Counter
component in your page or layout.API Reference
It's the same as the React client API reference, since the RivetKit React package is used in both Next.js and React applications.