{"id":25323806,"url":"https://github.com/devzgabriel/lupi","last_synced_at":"2025-10-29T02:30:56.048Z","repository":{"id":276386054,"uuid":"929138600","full_name":"devzgabriel/lupi","owner":"devzgabriel","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-07T22:26:13.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T22:42:15.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devzgabriel.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,"publiccode":null,"codemeta":null}},"created_at":"2025-02-07T21:58:08.000Z","updated_at":"2025-02-07T22:26:16.000Z","dependencies_parsed_at":"2025-02-07T22:42:23.263Z","dependency_job_id":"60264f49-d5cf-4b06-80ed-df6dddd17e5e","html_url":"https://github.com/devzgabriel/lupi","commit_stats":null,"previous_names":["devzgabriel/lupi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzgabriel%2Flupi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzgabriel%2Flupi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzgabriel%2Flupi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzgabriel%2Flupi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devzgabriel","download_url":"https://codeload.github.com/devzgabriel/lupi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238759670,"owners_count":19525872,"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":[],"created_at":"2025-02-14T00:44:34.866Z","updated_at":"2025-10-29T02:30:55.707Z","avatar_url":"https://github.com/devzgabriel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lupi: State management as easy as possible\n\nLupi is a state management library that is designed to be as easy to use as possible.\n\n## Features\n\n- **Ready-to-use Hook**: Lupi has a ready-to-use hook that you can use to create a store in your React components.\n- **Type-safe**: Lupi is written in TypeScript, so you can be sure that your store is type-safe.\n- **Persistency**: Lupi can persist your store in the browser's local storage automatically if you provide a `storageKey` option.\n- **Security**: If you provide a `encryptKey` string, Lupi will encrypt your store before saving it to the local storage.\n- **Actions**: You can define actions to modify the store and abstract the logic from the components.\n\n## WIP Features\n\n- **Validation**: Lupi will have a validation feature that allows you to validate the store's state.\n\n## Installation\n\nYou can install Lupi using npm:\n\n```bash\nnpm install lupi\n```\n\nor using yarn:\n\n```bash\nyarn add lupi\n```\n\n## Example Usage\n\nHere is an example of how to use the `createStore` from the `lupi` library in a React component:\n\n```tsx\nimport { createStore } from 'lupi';\nimport './App.css';\n\nconst useCounter = createStore(0);\n\nfunction MyChildComponent() {\n  const { state: counter, copyWith } = useCounter();\n\n  return \u003cbutton onClick={() =\u003e copyWith(counter + 1)}\u003ecount is {counter}\u003c/button\u003e;\n}\n\nfunction AnotherChildComponent() {\n  const { state: counter, copyWith } = useCounter();\n\n  return \u003cbutton onClick={() =\u003e copyWith(counter - 1)}\u003ecount is {counter}\u003c/button\u003e;\n}\n\nfunction App() {\n  const { state: counter } = useCounter();\n\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eSimple Counter\u003c/h1\u003e\n      \u003cp\u003eCount is {counter}\u003c/p\u003e\n\n      \u003cMyChildComponent /\u003e\n      \u003cAnotherChildComponent /\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\n## Options\n\nYou can pass an object as the second argument to the `createStore` function to configure the store:\n\n```tsx\nconst useCounter = createStore(0, {\n  // The key to save the store in the local storage\n  storageKey: 'counter',\n\n  // The key to encrypt the store, if empty, the data will be saved as plain text\n  // Recommended to use if you want to save sensitive data\n  encryptKey: 'my-secret-key',\n\n  actions: {\n    // You can define actions to modify the store\n    increment: (state: number) =\u003e state + 1,\n    decrement: (state: number) =\u003e state - 1,\n\n    // You can also pass a payload to the action\n    equation: (state: number, numberA: number, numberB: number) =\u003e (state * numberA) / numberB,\n  },\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevzgabriel%2Flupi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevzgabriel%2Flupi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevzgabriel%2Flupi/lists"}