{"id":13537076,"url":"https://github.com/DevanB/xstate-examples","last_synced_at":"2025-04-02T03:31:36.419Z","repository":{"id":37820572,"uuid":"206982775","full_name":"DevanB/xstate-examples","owner":"DevanB","description":"Practical examples of statechart-based solutions with xstate.","archived":false,"fork":false,"pushed_at":"2024-04-22T10:33:57.000Z","size":18076,"stargazers_count":138,"open_issues_count":4,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-22T11:43:25.665Z","etag":null,"topics":["react","state-charts","state-machine","state-machines","statecharts","svelte","vue","xstate"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevanB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-09-07T14:52:55.000Z","updated_at":"2024-04-23T12:01:49.234Z","dependencies_parsed_at":"2024-04-22T11:54:12.577Z","dependency_job_id":null,"html_url":"https://github.com/DevanB/xstate-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevanB%2Fxstate-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevanB%2Fxstate-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevanB%2Fxstate-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevanB%2Fxstate-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevanB","download_url":"https://codeload.github.com/DevanB/xstate-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246751272,"owners_count":20827862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","state-charts","state-machine","state-machines","statecharts","svelte","vue","xstate"],"created_at":"2024-08-01T09:00:54.641Z","updated_at":"2025-04-02T03:31:35.476Z","avatar_url":"https://github.com/DevanB.png","language":"TypeScript","readme":"# xstate-examples\n\n## Explanation\nThis repo serves as a resource for any developer curious about [state machines](https://statecharts.github.io/what-is-a-state-machine.html) and [statecharts](https://statecharts.github.io). I've heard developers that _want_ to use state machines, but have not found the \"perfect reason\" to utilize them. Now the \"perfect reason\" is easier to find. 😉\n\n## Repository Structure\n- Each example is in it's own directory.\n- Each example is a small application created with [Create React App](https://create-react-app.dev)/[vue-cli](https://cli.vuejs.org/)/[Svelte Template](https://github.com/sveltejs/template), [Xstate](https://xstate.js.org), [tailwind](https://tailwindcss.com), [React Testing Library](https://testing-library.com/docs/react-testing-library/intro)/[Vue Testing Library](https://testing-library.com/docs/vue-testing-library/intro)/[Svelte Testing Library](https://testing-library.com/docs/svelte-testing-library/intro), and [cypress](https://www.cypress.io).\n- Each example has a README with link to the [xstate visualization tool](https://xstate.js.org/viz/) for that example's state machine/statechart.\n- Each example uses [model-based testing](https://css-tricks.com/model-based-testing-in-react-with-state-machines/) and state machine/statechart best practices.\n\n## Current Examples\n- Trivia Game [React](/trivia-game-react) | [Vue](/trivia-game-vue) | [Svelte](/trivia-game-svelte)\n\n## Future Examples\n- React Native \"Simon Says\" game\n- Authentication flow\n- Welcome/walkthrough flow\n- Todos\n- Ticket selection and payment flow\n- Stepped form/wizard\n- Medium-like article creation/updating \n\n## Examples Showing Specific State Machine Concepts\n- [Guards](https://xstate.js.org/docs/guides/guards.html): Trivia Game [React](/trivia-game-react/src/machine.ts#L47) | [Vue](/trivia-game-vue/src/machine.js#L46) | [Svelte](/trivia-game-svelte/src/machine.js#L46)\n- [Transient Transitions](https://xstate.js.org/docs/guides/transitions.html#transient-transitions): Trivia Game [React](/trivia-game-react/src/machine.ts#L44-L48) | [Vue](/trivia-game-vue/src/machine.js#L43-L47) | [Svelte](/trivia-game-svelte/src/machine.js#L43-L47)\n- [Invoking Services (Promises)](https://xstate.js.org/docs/guides/communication.html#the-invoke-property): Trivia Game [React](/trivia-game-react/src/machine.ts#L22-L34) | [Vue](/trivia-game-vue/src/machine.js#L21-L33) | [Svelte](/trivia-game-svelte/src/machine.js#L21-L33)\n\n## Handy Resources\n- [Xstate documentation](https://xstate.js.org)\n- [Statecharts community](https://spectrum.chat/statecharts)\n- [World of Statecharts](https://statecharts.github.io)\n","funding_links":[],"categories":["Awesome XState","TypeScript"],"sub_categories":["Articles"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDevanB%2Fxstate-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDevanB%2Fxstate-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDevanB%2Fxstate-examples/lists"}