As part of helping make learning about state machines, the actor model, and XState easier, we’ve been working hard on creating examples for the community. One of the most frequently requested examples has been server-side workflows. And now they’re here! We’ve got 25 new examples specifically for this purpose in the XState GitHub repo.
Based on the CNCF Serverless workflow specification, these examples showcase the power and versatility of XState v5 when it comes to server-side workflows. These examples cover many use cases, from simple state machines to more complex workflows. Whether you are new to XState or an experienced user, we hope you’ll find these examples useful.
- Hello world workflow example
- Greeting workflow example
- Event-based greeting workflow example
- Solving math problems example
- Parallel execution workflow example
- Async function invocation workflow example
- Async subflow invocation workflow example
- Event-based transitions workflow example
- Applicant request decision workflow example
- Provision orders (error handling) workflow example
- Monitor job for completion (polling) workflow example
- Send CloudEvent on workflow completion example
- Monitor patient vital signs workflow example
- Finalize college application workflow example
- Perform customer credit check workflow example
- Handle car auction bids (scheduled start) workflow example
- Check inbox periodically (cron-based workflow start) example
- Event-based service workflow example
- Reusing function and event definitions workflow example
- New patient onboarding (error checking and retries) workflow example
- Purchase order deadline (ExecTimeout) workflow example
- Accumulate room readings and create timely reports (ExecTimeout and KeepActive) workflow example
- Car vitals checks (SubFlow Repeat) workflow example
- Book lending workflow example
- Filling a glass of water workflow example
Have you any examples to add? Check out our contribution guidelines; we’d love your pull request! If you have any questions or want to chat about these examples, please join our Discord. Our team and community will be happy to help.