Quickstart
Next.js Quickstart
Get started with Rivet Actors in Next.js
Create a Next.js App
Command Line
Install RivetKit
Create an Actor
Create a simple counter actor:
src/rivet/registry.ts
Setup RivetKit client
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.
Setup Registry API routes
src/app/api/registry/[...all]/route.ts
Use the Actor in a Component
src/components/Counter.tsx
Make sure to import the
Counter
component in your page or layout.For more examples how to connect to your actors using React, check the RivetKit React documentation.