Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/statelyai/xstate/llms.txt

Use this file to discover all available pages before exploring further.

XState is a state management and orchestration solution for JavaScript and TypeScript apps. It has zero dependencies, and is useful for frontend and backend application logic. It uses event-driven programming, state machines, statecharts, and the actor model to handle complex logic in predictable, robust, and visual ways. XState provides a powerful and flexible way to manage application and workflow state by allowing developers to model logic as actors and state machines.

Key features

State machines

Model your application logic as finite state machines and statecharts for predictable behavior

Actor model

Build complex systems using the actor model for orchestration and communication between independent processes

TypeScript-first

Full TypeScript support with strong type inference for states, events, and context

Framework agnostic

Works with React, Vue, Svelte, Solid, or any JavaScript framework

Why XState?

Statecharts are a formalism for modeling stateful, reactive systems. This is useful for declaratively describing the behavior of your application, from the individual components to the overall application logic. XState helps you:
  • Prevent impossible states - Your state machines can only be in one state at a time, eliminating entire classes of bugs
  • Visualize your logic - Use Stately Studio to create, edit, and visualize your state machines
  • Test comprehensively - Generate test paths automatically from your state machine logic
  • Handle side effects - Manage async operations, timers, and other side effects in a predictable way

Get started

Quick start

Build your first state machine in 5 minutes

Core concepts

Learn the fundamentals of state machines and actors

API reference

Explore the complete XState API documentation

Examples

See XState in action with real-world examples

Stately Studio

Create state machines visually with Stately Studio:
  • Visually create, edit, and collaborate on state machines
  • Export to many formats, including XState v5
  • Test path and documentation autogeneration
  • Deploy to Stately Sky
  • Generate and modify machines with Stately AI

Try Stately Studio

Start creating state machines visually

Build docs developers (and LLMs) love