RivetKit Real-Time Actor Example on Vercel
Overview
A Vercel-optimized adaptation of the RivetKit “hello world” example: a real-time counter whose state is held in a Rivet Actor and synchronized across all connected clients, deployed via the hono/vercel adapter.
Why It Exists
To evaluate RivetKit’s stateful-actor model on Vercel, exploring how persistent, real-time backend state and event broadcasting behave under a serverless/edge deployment target, using a minimal but complete full-stack example.
What We Built
- An actor definition (
src/actors.ts) holding persistent counter state and broadcasting change events. - A minimal Hono server (
src/server.ts) plus a Vercel function entrypoint (api/index.ts) using thehono/verceladapter. - A React frontend (
frontend/App.tsx) consuming theuseActorhook from@rivetkit/reactwith live event subscriptions. - Vercel configuration (
vercel.jsonrewrites), Vite build, Turbo, and Vitest setup.
Technologies & Approach
TypeScript across the stack: RivetKit actors for persistent, event-driven state; Hono for the HTTP layer; React + Vite for the client; deployed to Vercel via the Hono adapter. Adapted from the upstream MIT-licensed Rivet example.
Outcome / Impact
Validated that RivetKit’s actor-based real-time state model deploys and runs on Vercel, with multiple actor instances and cross-client synchronization working through the hono/vercel adapter, a useful reference for stateful real-time features on serverless infrastructure.
Capabilities Demonstrated
- Evaluating stateful actor frameworks (RivetKit) on serverless/edge platforms
- Real-time state synchronization and event broadcasting across clients
- Adapting Hono apps to Vercel deployment
- Full-stack TypeScript with React hooks for live backend state