{"id":22803623,"url":"https://github.com/Neohertz/crate","last_synced_at":"2025-08-10T04:31:55.611Z","repository":{"id":243962849,"uuid":"813855951","full_name":"Neohertz/crate","owner":"Neohertz","description":"A tiny little state system for roblox-ts.","archived":false,"fork":false,"pushed_at":"2024-06-24T15:38:06.000Z","size":122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T02:27:57.444Z","etag":null,"topics":["roblox","typescript"],"latest_commit_sha":null,"homepage":"https://neohertz.dev/docs/crate/about","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neohertz.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}},"created_at":"2024-06-11T21:59:47.000Z","updated_at":"2024-08-01T16:25:15.000Z","dependencies_parsed_at":"2024-06-23T12:15:34.408Z","dependency_job_id":null,"html_url":"https://github.com/Neohertz/crate","commit_stats":null,"previous_names":["neohertz/crate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neohertz%2Fcrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neohertz%2Fcrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neohertz%2Fcrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neohertz%2Fcrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neohertz","download_url":"https://codeload.github.com/Neohertz/crate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228805552,"owners_count":17974806,"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":["roblox","typescript"],"created_at":"2024-12-12T10:01:02.128Z","updated_at":"2024-12-12T10:01:27.879Z","avatar_url":"https://github.com/Neohertz.png","language":"TypeScript","funding_links":[],"categories":["State Management"],"sub_categories":["Crate \u003cimg src=\"roblox-ts.svg\" width=\"18px\" /\u003e"],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Neohertz/crate\"\u003e\u003cimg width=\"150\" height=\"150\" src=\"public/logo.png\" alt=\"Crate\"\u003e\u003c/a\u003e\n\t\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003e\n\tCrate\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n    \u003cb\u003e\n        A simple to use, scalable state container built for the \u003ca href=\"https://roblox-ts.com\"\u003eroblox-ts\u003c/a\u003e ecosystem\n    \u003c/b\u003e\n\u003ch4\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Downloads][downloads-shield]][downloads-url]\n[![Contributors][contributors-shield]][contributors-url]\n[![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url]\n[![License][license-shield]][license-url]\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#-notice\"\u003eNotice\u003c/a\u003e •\n    \u003ca href=\"#-installation\"\u003eInstallation\u003c/a\u003e •\n    \u003ca href=\"#-usage\"\u003eUsage\u003c/a\u003e •\n    \u003ca href=\"#-react\"\u003eReact\u003c/a\u003e •\n    \u003ca href=\"https://docs.neohertz.dev/docs/crate/about\"\u003eDocumentation\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# 📛 Notice\n\n\u003e [!CAUTION]\n\u003e While crate appears to be stable, `v1.0.1` has not been thoroughly battle tested. Use at your own risk, as you may encounter breaking bugs.\n\n# 💻 Installation\n\nTo install crate, run one of the following commands in your project's directory.\n\n```bash\nnpm i @rbxts/crate\nyarn add @rbxts/crate\npnpm add @rbxts/crate\n```\n\n# 💫 Usage\n\nBelow is a basic example of using crate to manage player data.\n\n```ts\nimport { Crate } from \"@rbxts/crate\";\nimport { Players } from \"@rbxts/services\";\n\nenum AUTH_LEVEL {\n  USER,\n  ADMIN,\n}\n\ninterface User {\n  player: Player;\n  authLevel: AUTH_LEVEL;\n\n  stats: {\n    cash: 0;\n  };\n}\n\n// Determine a player's auth level.\nfunction getUserAuthLevel(player: Player) {\n  return player.UserId === 1 ? AUTH_LEVEL.ADMIN : AUTH_LEVEL.USER;\n}\n\n// Create and return a crate for the provided user.\nfunction createUserCrate(player: Player): Crate\u003cUser\u003e {\n  const user = new Crate\u003cUser\u003e({\n    player: player,\n    authLevel: getUserAuthLevel(player),\n\n    stats: {\n      cash: 0,\n    },\n  });\n\n  return user;\n}\n\n// Listen for player join.\nPlayers.PlayerAdded.Connect((player) =\u003e {\n  const user = createUserCrate(player);\n\n  // Listen to updates to the player's cash.\n  user.onUpdate(\n    (state) =\u003e state.stats.cash,\n    (cash) =\u003e print(cash),\n  );\n\n  // If the user is an admin, give them a bunch of cash.\n  if (user.getState((s) =\u003e s.authLevel) === AUTH_LEVEL.ADMIN) =\u003e {\n    user.update({\n      stats: {\n        cash: 1000000,\n      },\n    });\n  })  \n});\n```\n\n\u003e [!NOTE]\n\u003e To learn more, visit the [docs](https://docs.neohertz.dev/docs/crate/about).\n\n# ⚛️ React\n\nFor more information on using crates with react, see [@rbxts/react-crate](https://github.com/Neohertz/react-crate).\n\n\n[downloads-shield]: https://img.shields.io/npm/d18m/%40rbxts%2Fcrate?style=for-the-badge\n[downloads-url]: https://www.npmjs.com/package/@rbxts/crate\n[contributors-shield]: https://img.shields.io/github/contributors/neohertz/crate?style=for-the-badge\n[contributors-url]: https://github.com/Neohertz/crate/graphs/contributors\n[stars-shield]: https://img.shields.io/github/stars/neohertz/crate?style=for-the-badge\n[stars-url]: https://github.com/Neohertz/crate/stargazers\n[issues-shield]: https://img.shields.io/github/issues/neohertz/crate?style=for-the-badge\n[issues-url]: https://github.com/Neohertz/crate/issues\n[license-shield]: https://img.shields.io/github/license/neohertz/crate?style=for-the-badge\n[license-url]: https://github.com/Neohertz/crate/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeohertz%2Fcrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNeohertz%2Fcrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeohertz%2Fcrate/lists"}