Features
- Persistent state: Actor state automatically saved and restored across restarts
- Typed state management: Full TypeScript type safety for state objects
- State initialization: Define initial state with
createStateorstateproperty - Automatic serialization: State changes automatically persisted without manual saves
Implementation
This example demonstrates state management in Rivet Actors with a simple counter:
- Actor Definition (
src/backend/registry.ts): Defines thecounteractor with a count state that persists across actor restarts
Resources
Read more about state management, actions, and lifecycle hooks.



