Skip to content
Version: XState v5

Installation

XState has zero dependencies and runs anywhere that JavaScript runs. You can install XState using your favorite package manager, like npm, pnpm, or yarn.

npm install xstate

CDN

You can also import XState from various CDNs:

import { createMachine, createActor } from 'https://esm.run/xstate';
import { createMachine, createActor } from 'https://esm.sh/xstate';
import { createMachine, createActor } from 'https://cdn.skypack.dev/xstate';