{"id":28092466,"url":"https://github.com/dourajs/doura","last_synced_at":"2025-05-13T13:17:05.172Z","repository":{"id":62878298,"uuid":"563255986","full_name":"dourajs/doura","owner":"dourajs","description":"The simple, intuitive and reactive state manager you've been waiting for.","archived":false,"fork":false,"pushed_at":"2024-07-03T10:17:31.000Z","size":2217,"stargazers_count":32,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T14:52:12.460Z","etag":null,"topics":["doura","immutable","react","reactive","state-management"],"latest_commit_sha":null,"homepage":"https://dourajs.github.io/doura/","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/dourajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null},"funding":{"github":["liximomo"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-11-08T08:30:09.000Z","updated_at":"2025-03-13T05:42:31.000Z","dependencies_parsed_at":"2023-11-21T09:26:05.235Z","dependency_job_id":"1e6916fe-0053-4fe9-9386-f6ddc61dad4f","html_url":"https://github.com/dourajs/doura","commit_stats":{"total_commits":109,"total_committers":2,"mean_commits":54.5,"dds":"0.15596330275229353","last_synced_commit":"0611cd4dccd417b0ac964a77797f66f37c697fa7"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dourajs%2Fdoura","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dourajs%2Fdoura/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dourajs%2Fdoura/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dourajs%2Fdoura/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dourajs","download_url":"https://codeload.github.com/dourajs/doura/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253292122,"owners_count":21885036,"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":["doura","immutable","react","reactive","state-management"],"created_at":"2025-05-13T13:17:04.494Z","updated_at":"2025-05-13T13:17:05.148Z","avatar_url":"https://github.com/dourajs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/liximomo"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003edoura\u003c/h1\u003e\n\u003c/div\u003e\n\nDoura is a decentralized state management solution based on the concept of model. It's very simple and intuitive.\n\n- 🔑 100% TypeScript Support\n- ⚛️ Reactive and Immutable\n- 🔗 Models are organized in a decentralized way\n\n\u003chr /\u003e\n\n## Installation\n\nInstall with npm:\n\n```\nnpm install doura\n```\n\nInstall with yarn\n\n```\nyarn add doura\n```\n\n## Usage\n\n### Define Model\n\n```tsx\nimport { defineModel } from 'doura'\nimport { useModel } from 'react-doura'\n\nconst todoModel = defineModel({\n  state: {\n    todos: [\n      {\n        id: 0,\n        text: 'read books',\n        isFinished: true,\n      },\n    ],\n    /** @type {'all' | 'unfinished'} */\n    filter: 'all',\n  },\n  views: {\n    unfinishedTodos() {\n      // autocompletion! ✨\n      return this.todos.filter((todo) =\u003e !todo.isFinished)\n    },\n    filteredTodos() {\n      if (this.filter === 'unfinished') {\n        return this.unfinishedTodos\n      }\n      return this.todos\n    },\n  },\n  actions: {\n    // any amount of arguments, return a promise or not\n    setFilter(filter) {\n      // you can directly mutate the state\n      this.filter = filter\n    },\n    // action can be asynchronous\n    async getTodos() {\n      this.todos = await fetchTodos('httpds://api.example.com/todos')\n    }\n  },\n})\n```\n\n### Bind to React Components\n\n```tsx\nimport { useModel } from 'react-doura'\n\nexport function TodoApp() {\n  // type of `filteredTodos` and `setFilter` are inferred automatically\n  const { filteredTodos, setFilter } = useModel(todoModel)\n\n  return (\n    \u003cdiv\u003e\n      \u003cdiv\u003e\n        \u003cinput\n          type=\"checkbox\"\n          id=\"filter\"\n          onClick={(event) =\u003e\n            setFilter(event.target.checked ? 'unfinished' : 'all')\n          }\n        /\u003e\n        \u003clabel htmlFor=\"filter\"\u003eOnly show unfinished\u003c/label\u003e\n      \u003c/div\u003e\n      \u003cul\u003e\n        {filteredTodos.map((todo) =\u003e (\n          \u003cli key={todo.id}\u003e\n            \u003cinput type=\"checkbox\" checked={todo.isFinished} /\u003e\n            {todo.text}\n          \u003c/li\u003e\n        ))}\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## Credits\n\nDoura is greatly inspired by following excellent projects:\n\n- [Immer](https://github.com/immerjs/immer)\n- [Vue.js](https://github.com/vuejs)\n- [Pinia](https://github.com/vuejs/pinia)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdourajs%2Fdoura","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdourajs%2Fdoura","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdourajs%2Fdoura/lists"}