examples/hello-world-effect/README.md
Minimal counter actor built with the Effect SDK for Rivet Actors.
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/hello-world-effect
npm install
npm run dev
In a separate terminal, run the client against the server:
npm run client
Actor.make and implement it with toLayer, returning action handlers from an Effect wake scopeIncrement and GetCount are standalone Action.make values with Schema payloads and successes validated end to endIncrement declares a NegativeAmountError that arrives on the caller as a real tagged instance, caught with Effect.catchTagSubscriptionRef-like State APIThe actor is split into a public contract and a server-only implementation:
src/actors/counter/api.ts): Declares the Counter actor and its actionssrc/actors/counter/live.ts): Implements the wake scope, state schema, and action handlerssrc/main.ts): Composes the actor layer and serves it with Registry.servesrc/client.ts): An Effect client using the typed Counter.client accessorRead more about actions, state, events, and the Effect quickstart.
MIT