{"id":24719871,"url":"https://github.com/mikelpmc/react-xstate-api-auth","last_synced_at":"2025-06-29T07:33:33.124Z","repository":{"id":39009460,"uuid":"252222061","full_name":"mikelpmc/react-xstate-api-auth","owner":"mikelpmc","description":"Basic demo to show the usage of React and Xstate with authentication flow","archived":false,"fork":false,"pushed_at":"2023-01-06T00:36:26.000Z","size":4889,"stargazers_count":29,"open_issues_count":24,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-28T03:11:56.543Z","etag":null,"topics":["auth","context-api","finite-state-machine","javascript","react","statechart","xstate"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mikelpmc.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}},"created_at":"2020-04-01T15:59:00.000Z","updated_at":"2025-06-02T19:07:29.000Z","dependencies_parsed_at":"2023-02-05T00:34:16.051Z","dependency_job_id":null,"html_url":"https://github.com/mikelpmc/react-xstate-api-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mikelpmc/react-xstate-api-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikelpmc%2Freact-xstate-api-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikelpmc%2Freact-xstate-api-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikelpmc%2Freact-xstate-api-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikelpmc%2Freact-xstate-api-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikelpmc","download_url":"https://codeload.github.com/mikelpmc/react-xstate-api-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikelpmc%2Freact-xstate-api-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262557293,"owners_count":23328286,"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":["auth","context-api","finite-state-machine","javascript","react","statechart","xstate"],"created_at":"2025-01-27T11:44:44.244Z","updated_at":"2025-06-29T07:33:33.090Z","avatar_url":"https://github.com/mikelpmc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React xstate auth demo\n\nBasic demo to show the usage of React and Xstate with authentication flow\n\nYou can visualize the auth machine here: https://xstate.js.org/viz/?gist=94e9a29e1ab016e06b8b354b9d558cf2\n\nProject Structure:\n\n```sh\n    -server\n        -src\n            -data\n                -schemas\n            -logic\n            -routes\n            -utils\n        -index.js\n        -.env\n\n    -client\n        -src\n            -components\n            -machine\n            -provider\n            -service\n            -utils\n            -index.js\n        -.env\n```\n\nSystem Requirements:\n\n- Node\n- Mongodb\n\nServer:\n\n1. Install the project dependencies\n\n```sh\n$ npm i\n```\n\n2. Create the .env file on the root of the server/ folder\n\n```sh\n$ touch .env\n```\n\n.env\n\n```sh\nDB_URL=mongodb://localhost:27017/your-database\nPORT=5000\nTOKEN_SECRET=your-secret\nTOKEN_EXP=3h\n```\n\n3. Start the API\n\n```sh\n$ npm start\n```\n\nClient:\n\n1. Download dependencies\n\n```sh\n$ npm i\n```\n\n2. Create the .env file on the root of the client/ folder\n\n```sh\n$ touch .env\n```\n\n.env\n\n```sh\nREACT_APP_API_BASE_URL=http://localhost:5000/api\n```\n\n\\*Note: In order to enviroment variables work with this react project without touching any config file they all have to start with REACT_APP\n\n3. Start the app\n\n```sh\n$ npm start\n```\n\nAuthor: [http://github.com/mikelpmc](http://github.com/mikelpmc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikelpmc%2Freact-xstate-api-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikelpmc%2Freact-xstate-api-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikelpmc%2Freact-xstate-api-auth/lists"}