examples/state-render/README.md
Note: This is the Render-optimized version of the state example. It adds a production HTTP server, Vite build, and a
render.yamlBlueprint for deploying to Render.
Demonstrates persistent state management in Rivet Actors with automatic state saving and restoration.
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/state
npm install
npm run dev
createState or state propertyThis example demonstrates state management in Rivet Actors:
src/actors.ts): chatRoom with persistent message list, sendMessage, clearMessages, and broadcast eventssrc/server.ts): Hono app routing /api/rivet/* to the registry handlerfrontend/app/App.tsx): useActor hook with real-time event subscriptions and auto-scrollexamples/state-render if deploying from the monorepo.| Variable | Description |
|---|---|
RIVET_ENDPOINT | Backend endpoint URL from your Rivet Cloud project |
RIVET_PUBLIC_ENDPOINT | Public endpoint URL from your Rivet Cloud project |
RIVET_ENVOY_VERSIONis automatically derived from Render'sRENDER_GIT_COMMIT— no manual bump needed per deploy. Set it explicitly to override.
MIT