What problem does it solve?
effect-machine removes the brittleness of ad-hoc async state handling by giving you a single typed model for state, events, transitions, and side effects.
Core Features & Use Cases
- Schema-first states & events: Define states/events as Effect-compatible schemas so constructors, validation, and serialization come from one place.
- Typed transition handlers: Implement state transitions with type-safe event payloads, including reply-bearing events for ask/reply flows.
- State-scoped effects & async orchestration: Use spawn/task/background, automatic cancellation on state exit, plus timeouts and postpone buffering for real workflow control.
- Testing, replay, and lifecycle hooks: Simulate machines, assert paths/reaches, replay transitions with stubbed side effects, and integrate recovery/durability for persistence.
Quick Start
Tell the AI: "Create an effect-machine for a Checkout workflow with typed schemas for states and events, state-scoped charging logic via spawn, a timeout that transitions to a failure state, and an ask/reply event that returns the current total amount."