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