{"id":28912128,"url":"https://github.com/devmunro/otterlightstore","last_synced_at":"2026-03-01T20:32:43.568Z","repository":{"id":293867617,"uuid":"985358884","full_name":"devmunro/otterlightstore","owner":"devmunro","description":"A beginner-friendly global state management library for React, inspired by Zustand.","archived":false,"fork":false,"pushed_at":"2025-05-18T17:09:02.000Z","size":76,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T18:20:16.723Z","etag":null,"topics":["beginner-friendly","frontend","hooks","javascript","library","react","state-management","zustand"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devmunro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-05-17T15:41:47.000Z","updated_at":"2025-05-18T17:09:05.000Z","dependencies_parsed_at":"2025-06-21T20:01:34.355Z","dependency_job_id":"531aabf3-e8e4-4dfb-a604-bced69dede45","html_url":"https://github.com/devmunro/otterlightstore","commit_stats":null,"previous_names":["devmunro/reactlightstore","devmunro/otterlightstore"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devmunro/otterlightstore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmunro%2Fotterlightstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmunro%2Fotterlightstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmunro%2Fotterlightstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmunro%2Fotterlightstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devmunro","download_url":"https://codeload.github.com/devmunro/otterlightstore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmunro%2Fotterlightstore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29983174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["beginner-friendly","frontend","hooks","javascript","library","react","state-management","zustand"],"created_at":"2025-06-21T20:01:15.580Z","updated_at":"2026-03-01T20:32:43.532Z","avatar_url":"https://github.com/devmunro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://github.com/user-attachments/assets/665bf2f5-878a-4922-845e-58ee63aa5497)\n\n\n# otterlightstore\n----------------\nA lightweight state management library for React using useSyncExternalStore. Provides simple APIs for managing global state with support for async states, object/array updates, and built-in devtools history.\n\n- [Features](#features)\n- [Installation](#installation)\n- [How to use](#how-to-use)\n- [Devtools](#devtools)\n\n\n#Features\n--------\n\n*   Simple, minimalistic API\n    \n*   React hooks with selector support\n    \n*   Async state handling built-in\n    \n*   Helpers for toggling booleans, updating arrays/objects\n    \n*   Devtools history \u0026 state restore\n    \n*   No dependencies except React\n\n\u003cbr\u003e\n\n#Installation\n------------\n\n`npm install otterlightstore   `\n\nor\n\n`yarn add otterlightstore   `\n\n\u003cbr\u003e\n\n#How to start - Choose either 1a or 1b\n-----\n\n### 1a\\. Initialize Starter Store File\nRun this once to create a ready-to-use otter-store.js file in your current folder:\n\n`npx otterlightstore-init`\n\nThis file includes:\n\n* A basic store with example initial state\n* Setup for your React components to use the store\n* Example usage of helpers like toggling booleans and updating arrays\n\n\u003cbr\u003e\n\n### 1b\\. Create your store\n\n```js\nimport { createStore } from \"otterlightstore\";\n\nconst initialState = {\n  count: 0,\n  todos: [],\n  loading: false,\n};\n\nexport const store = createStore(initialState);\n```\n\n\u003cbr\u003e\n\n#How to use\n---------\n\n### 2\\. Use the store in your components\n\n```js\nimport React from \"react\";\nimport { store } from \"./store\";\n\nfunction Counter() {\n  const count = store.useLightStore((state) =\u003e state.count);\n\n  const increment = () =\u003e {\n    store.set({ count: count + 1 }, \"increment\");\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003cp\u003eCount: {count}\u003c/p\u003e\n      \u003cbutton onClick={increment}\u003eIncrement\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### 3\\. Async state example\n\n```js\nasync function fetchData() {\n  await store.asyncState(\"data\", async () =\u003e {\n    const response = await fetch(\"https://api.example.com/data\");\n    return response.json();\n  });\n}\n```\n\n### 4\\. Using helpers\n\n```js\nstore.toggleBoolean(\"isOpen\");\nstore.updateArray(\"todos\", (arr) =\u003e [...arr, { id: 1, text: \"Learn otterlightstore\" }]);\nstore.deleteFromArray(\"todos\", (todo) =\u003e todo.id === 1);\nstore.updateObject(\"user\", { name: \"Alice\" });\nstore.deleteFromObject(\"user\", \"age\");   \n````\n\n  \n\n#Devtools\n--------\n\nStore keeps a history (max 50). Use:\n\n`const history = store.devtools.getHistory();  store.devtools.restoreState(0);   `\n\nAPI Reference\n-------------\n\n### createStore(initialState, options)\n\nCreates a new store instance.\n\n*   initialState — Object, initial state\n    \n*   options — Object, supports { enableLogging: boolean }\n    \n\nReturns:\n\n*   get() — current state\n    \n*   set(partialState | updaterFn, actionName) — update state\n    \n*   useLightStore(selector) — React hook for subscription and selection\n    \n*   asyncState(key, asyncFn) — async state helper\n    \n*   toggleBoolean(key) — toggle boolean state\n    \n*   updateArray(key, updaterFn) — update array state\n    \n*   deleteFromArray(key, predicate) — delete from array\n    \n*   updateObject(key, partialUpdate) — partial object update\n    \n*   deleteFromObject(key, prop) — delete object prop\n    \n*   devtools — history and restore functions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmunro%2Fotterlightstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevmunro%2Fotterlightstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmunro%2Fotterlightstore/lists"}