Skip to content

XState

Open source

JavaScript library for state machines, statecharts and actors

XState preview

About XState

XState is an open source library for modeling application logic as state machines and statecharts. It also supports actors, which are independent units that send events to each other.

What it does

XState lets you describe the possible states of a component or process, the events that move between them, and the actions that run during each transition. Machines are plain data and functions, so they can be tested in isolation and run in browsers or on servers. Actor support lets several machines run at once and communicate with one another.

Who it's for

Frontend and backend developers who manage complex flows such as checkout, forms or multi-step wizards. It is useful wherever bugs come from impossible combinations of states.

Pricing and good to know

The library is free and open source under the MIT license. Statecharts have a learning curve, so start with one flow rather than the whole app. Check the library documentation for the current API, since it has changed between major versions.

Highlights

  • Finite state machines and statecharts
  • Actors that send events to each other
  • Guards and actions on state transitions
  • Machines that can be tested in isolation
  • Visualization of state graphs

Ratings & reviews

Rate XState

Stars alone count straight away.0/300

Checking that you are human…

Was this page helpful?
2 tools
Open source

Pinia

Official state store for Vue.js with type-safe, modular stores

Frameworks & Libraries
Open source

Zustand

Small state management library for React with a simple hook API

Frameworks & Libraries