# statelyai/xstate

State machines, statecharts, and actors for complex logic

Repository: https://github.com/statelyai/xstate
Canonical: https://ross.abutalabs.com/products/xstate
Homepage: https://stately.ai/docs
Language: TypeScript
License: MIT
License Family: permissive
Topics: state-machine, statechart, interpreter, visualizer, scxml, state, state-management, workflow, orchestration, finite-state-machine, fsm, javascript, statecharts, typescript, background-jobs, actor-model, reactive, state-machines, xstate
Last push: 2026-08-26T22:07:52+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 100
- inputs: {"age_days": 4006, "days_push": 7, "days_rel": 8, "gap_med": 1.0, "n_releases_24m": 149}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 30061, forks 1385 (observed 2026-08-28T04:11:53.819632+00:00)

## What it is
XState is a zero-dependency JavaScript/TypeScript library for state management and orchestration using state machines, statecharts, and the actor model. It lets developers model complex application and workflow logic in a predictable, testable, and visual way, integrating with React, Vue, Svelte, and other frameworks.

## Use cases
- manage complex frontend application state with state machines
- model multi-step workflows and background job orchestration
- replace Redux or Zustand with event-based state management
- prevent impossible states in UI logic
- visually design statecharts and export code
- implement actor-based concurrent logic in JavaScript

## When to choose
- your app logic has complex, interdependent states and transitions
- you need deterministic, easily testable state behavior
- you want visual modeling tools (Stately Studio, VS Code extension) alongside code
- you need both simple stores and full statechart orchestration in one ecosystem

## When to avoid
- you only need trivial local component state
- your team is unfamiliar with statecharts and the learning overhead isn't justified
- you need a minimal store under 1kb without machine semantics (consider @xstate/store instead)

## Facets
- artifact type: library
- maturity: active
- function: state-management, workflow-automation, concurrency
- domain: web-development, frontend, backend, developer-tools
- platform: cross-platform
- tags: state-machine, statechart, actor-model, fsm, event-driven, orchestration, scxml, react, vue, svelte, visual-editor, automation, nodejs, web-server, javascript, typescript

## Member repositories
- statelyai/xstate (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:53.819632+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:52:48.243108+00:00, confidence not recorded.
  - readme: https://github.com/statelyai/xstate (fetched 2026-08-28T04:11:53.819632+00:00, sha b393d3156734)
  - homepage: https://stately.ai/docs (fetched 2026-08-29T07:50:13.740210+00:00, sha c3be329e6b0f)
  - site_page: https://stately.ai/docs/xstate-store (fetched 2026-08-29T07:50:13.742971+00:00, sha 11895b5591a5)
  - site_page: https://stately.ai/docs/glossary (fetched 2026-08-29T07:50:13.745624+00:00, sha e3933b2c3958)
  - site_page: https://stately.ai/docs/xstate (fetched 2026-08-29T07:50:13.747242+00:00, sha c8e2ebe97799)
  - site_page: https://stately.ai/docs/migration (fetched 2026-08-29T07:50:13.748808+00:00, sha 0b8d2039c3a0)
  - site_page: https://stately.ai/docs/quick-start (fetched 2026-08-29T07:50:13.751016+00:00, sha 7279969a3eca)
  - site_page: https://stately.ai/docs/states (fetched 2026-08-29T07:50:13.752579+00:00, sha 3b77c3bb3447)
  - site_page: https://stately.ai/docs/studio (fetched 2026-08-29T07:50:13.754452+00:00, sha dc3b6d02077c)
  - site_page: https://stately.ai/docs/state-machines-and-statecharts (fetched 2026-08-29T07:50:13.756815+00:00, sha 77731682c42f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
