{"id":22132438,"url":"https://github.com/chiefgui/superstate","last_synced_at":"2025-09-10T16:43:54.407Z","repository":{"id":47401610,"uuid":"493455728","full_name":"chiefGui/superstate","owner":"chiefGui","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-24T04:14:41.000Z","size":2147,"stargazers_count":198,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-31T04:39:36.108Z","etag":null,"topics":["javascript","react","state-management","typescript"],"latest_commit_sha":null,"homepage":"https://superstate.dev","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/chiefGui.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":"2022-05-18T00:32:19.000Z","updated_at":"2024-12-27T18:18:10.000Z","dependencies_parsed_at":"2022-08-12T13:22:39.427Z","dependency_job_id":null,"html_url":"https://github.com/chiefGui/superstate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chiefGui/superstate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefGui%2Fsuperstate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefGui%2Fsuperstate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefGui%2Fsuperstate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefGui%2Fsuperstate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiefGui","download_url":"https://codeload.github.com/chiefGui/superstate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefGui%2Fsuperstate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274488814,"owners_count":25294790,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","react","state-management","typescript"],"created_at":"2024-12-01T18:41:32.874Z","updated_at":"2025-09-10T16:43:54.352Z","avatar_url":"https://github.com/chiefGui.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n_Is it a bird? Is it a plane? No, it is **superstate**!_\n\n\u003c/div\u003e\n\n![superstate hero](https://i.imgur.com/EhecV7G.png)\n\n\u003cdiv align=\"center\"\u003e\n   \n### Behold your next favorite state management library for the XXI century.\n  \n[Quick Start](https://superstate.dev/getting-started/first-state) · [Documentation](https://superstate.dev) · [Examples](https://superstate.dev/examples) · [API Reference](https://superstate.dev/api-reference/@superstate/core/superstate)\n\u003c/div\u003e\n\n---\n\n```shell\nyarn add @superstate/core\n```\n\n---\n\n#### ✨ **Simple, sleek \u0026 elegant API**\n\n```ts\nimport { superstate } from \"@superstate/core\"\n\nconst count = superstate(0)\n\ncount.set(5)\n\nconsole.log(count.now()) // 5\n```\n\n_Yep, that simple. No PhD required._\n\n#### 🤯 Mindlessly easy to share state across your entire app\n\n```ts\n// count.ts\nimport { superstate } from \"@superstate/core\"\n\nexport const count = superstate(0)\n\n// calculator.ts\nimport { count } from \"./count.ts\"\n\ncount.set(5)\n\n// app.ts\nimport { count } from \"./count.ts\"\n\n// When calculator.ts changes count, it'll call the callback below! :D\ncount.subscribe((value) =\u003e {\n  console.log(value)\n})\n```\n\n_The trick is the `export` keyword: to share your state, all you have to do is exporting and importing it._\n\n#### 📐 Designed with ergonomy and developer wellness in mind\n\n**superstate** puts the developer first\u0026mdash;from the beginner to the veteran. No changes are made without thorough consideration and confidence that working with superstate is pure pleasure.\n\n#### 🧩 Fully extensible\n\nInstead of building **superstate** with lots of useless opinionated features, the idea is to give you the tools to expand it as much as you need\u0026mdash;and only _when_ you need. Middlewares and Extensions are at your service.\n\n#### 📝 Built-in Drafts System\n\nGreat UX doesn't have to be a burden to build. With the built-in Drafts System, you can give your users second chances without spending an extra day on it.\n\n```ts\nconst count = superstate(0)\n\ncount.sketch(5)\nconsole.log(count.draft()) // 5\nconsole.log(count.now()) // 0\n\ncount.publish()\nconsole.log(count.draft()) // undefined\nconsole.log(count.now()) // 5\n```\n\n#### 🤘 Simple enough for prototypes and scalable enough for the world's next big thing\n\nRegardless of the scale of your project, **superstate** _will_ fit. It is very compact for prototypes, but if your app hits big, **superstate** follows along. Have an ongoing application? It's all right\u0026mdash;**superstate** can be incrementally adopted so you don't have to worry if the first rails are already built.\n\n#### ⌨️ Proudly written in TypeScript\n\nBuilding **superstate** without TypeScript was never an option.\n\n#### ⚛️ Deadly simple integration with React apps\n\n```tsx\nimport { superstate } from '@superstate/core'\nimport { useSuperState } from '@superstate/react'\n\nconst count = superstate(0)\n\nexport const MyComponent = () =\u003e {\n  useSuperState(count)\n\n  return (\n    \u003cdiv\u003e\n      \u003cdiv\u003eCount: ${count}\u003c/div\u003e\n      \u003cbutton onClick={() =\u003e count.set(prev =\u003e prev + 1))\u003eIncrease\u003c/button\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\nYou read it right: calling the `useSuperState(count)` hook is all you need to make your component re-render when `count` increases.\n\n#### 🌐 Works in the browser or in Node environments\n\nBrowser-only apps, hybrid apps (such as [Electron](https://www.electronjs.org/)), Node apps... check, check, check!\n\n---\n\n#### Brought to you by 🇧🇷 [Guilherme \"chiefGui\" Oderdenge](https://github.com/chiefGui).\n\n---\n\nThe MIT License (MIT)\n\nCopyright (c) 2022 Guilherme Oderdenge\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefgui%2Fsuperstate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiefgui%2Fsuperstate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefgui%2Fsuperstate/lists"}