GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - typeonce-dev/effect-machine: Schema-first state machines and statecharts for Effect

BranchesTags
Open more actions menu

Latest commit

 

History

284 Commits
284 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents/skills
.agents/skills
 
 
.changeset
.changeset
 
 
.claude/skills
.claude/skills
 
 
.github
.github
 
 
.vscode
.vscode
 
 
ai-docs
ai-docs
 
 
packages
packages
 
 
plans
plans
 
 
scripts
scripts
 
 
tooling/typescript-7
tooling/typescript-7
 
 
.gitignore
.gitignore
 
 
.oxlintrc.json
.oxlintrc.json
 
 
AGENTS.md
AGENTS.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
LLMS.md
LLMS.md
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 
api-reference-site.config.json
api-reference-site.config.json
 
 
api-reference.config.json
api-reference.config.json
 
 
dprint.json
dprint.json
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
tsconfig.base.json
tsconfig.base.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.packages.json
tsconfig.packages.json
 
 
tsconfig.tests.json
tsconfig.tests.json
 
 
vitest.config.ts
vitest.config.ts
 
 
vitest.docs.ts
vitest.docs.ts
 
 

Repository files navigation

@typeonce/effect-machine

Effect-native, schema-first, completely type-safe state machines and statecharts, inspired by XState.

The goal of effect-machine is to become a core effect module.

It originates from the following PR.

Quick look

import { Machine } from "@typeonce/effect-machine"
import { Effect } from "effect"
const Root = Machine.state({
  states: { Locked: {}, Unlocked: {} }
})
const Events = Machine.events({ Coin: {}, Push: {} })
const Turnstile = Machine.make({
  root: Root,
  events: Events
}).handle({
  initial: {
    target: "Locked"
  },
  states: {
    Locked: { on: { Coin: { target: "Unlocked" } } },
    Unlocked: { on: { Push: { target: "Locked" } } }
  }
})
const program = Effect.gen(function*() {
  const ref = yield* Machine.start(Turnstile)
  yield* ref.send(Events.Coin())
})

State and event schemas define the protocol. The root defines the topology and the handler tree adds behavior, and the result runs as an Effect-managed machine.

Packages

The workspace publishes four packages at the same version:

  • @typeonce/effect-machine contains the machine runtime, testing modules, and documentation.
  • @typeonce/effect-machine-react owns machine atoms in React without subscribing their owners to machine state.
  • @typeonce/effect-machine-devtools contains the publishable local machine visualizer and CLI.
  • @typeonce/oxlint-plugin-effect-machine checks Effect Machine models for common structural mistakes.

Install matching versions so the runtime, devtools, and lint rules stay aligned.


XState is the project's main inspiration and reference for statechart semantics and API coverage.

Direct API comparisons exposed gaps in Effect Machine, and benchmarks against XState drove many runtime performance improvements. effect-machine is not a direct XState replacement.

About

Schema-first state machines and statecharts for Effect

effect-machine.typeonce.dev/

Topics

effecteffect-tsstate-chartsstate-machinestate-management

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

250 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.