Open
Conversation
Adds first-class Effect-TS support for RivetKit actors with: - RivetActorContext tag for injecting actor context into Effect pipelines - Effect wrappers for all lifecycle hooks and actions - ManagedRuntime support for bringing custom Effect layers - Queue helpers for message processing - Tagged errors (RuntimeExecutionError, StatePersistenceError) - Comprehensive test suite (13 tests) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Adds an example at examples/effect/ demonstrating @rivetkit/effect usage: - Counter actor using Action.effect() for all actions - OnCreate lifecycle hook with Effect-TS - Log helpers for structured logging - Batch increment, decrement, and reset operations - React frontend with @rivetkit/react - Integration tests using setupTest from rivetkit/test - Fixes @rivetkit/effect package.json exports to match tsup output
|
Super happy to see this near completion. Nice work @Makisuo! Excited to try this out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@rivetkit/effectatrivetkit-typescript/packages/effect/— first-class Effect-TS integration for RivetKit actorsRivetActorContexttag, Effect wrappers for all lifecycle hooks and actions, ManagedRuntime support, queue helpers, and tagged errorsexamples/effect/— a full counter example with React frontend and integration testsMotivation
Effect-TS is increasingly popular for building reliable TypeScript applications. This package lets developers use Effect's composable error handling, dependency injection, and runtime management when building RivetKit actors — without giving up any of the existing actor API.
What's Included
Package (
rivetkit-typescript/packages/effect/)actor.tsRivetActorContexttag + accessor helpers (state, vars, broadcast, etc.)action.tsAction.effect()wrapper for action handlerslifecycle.tsOnCreate.effect(),OnWake.effect(), etc. for all lifecycle hooksrivet-actor.tsactor()factory with optionalruntimefor ManagedRuntimeruntime.tsrunPromise/runPromiseExitqueue.tsQueue.next()/Queue.nextMultiple()helperslog.tserrors.tsRuntimeExecutionError+StatePersistenceErrortagged errorsExample (
examples/effect/)Counter actor demonstrating:
Action.effect()for all action handlers (increment, decrement, reset, batchIncrement)OnCreate.effect()lifecycle hookLog.info()for structured logging@rivetkit/reactsetupTestTest plan
pnpm run testinrivetkit-typescript/packages/effect/)pnpm run build)pnpm run check-typespasses in CI