{"id":17722830,"url":"https://github.com/elsoul/fresh-atom","last_synced_at":"2026-05-09T04:33:21.200Z","repository":{"id":259345432,"uuid":"877024081","full_name":"elsoul/fresh-atom","owner":"elsoul","description":"A lightweight global state management library inspired by Recoil and Jotai, specifically designed for use in Fresh on Deno.","archived":false,"fork":false,"pushed_at":"2024-10-24T01:31:14.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-08T04:07:26.691Z","etag":null,"topics":["deno","fresh","preact"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elsoul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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-10-23T00:36:35.000Z","updated_at":"2025-05-13T17:35:22.000Z","dependencies_parsed_at":"2024-10-24T17:11:24.065Z","dependency_job_id":"1b4ef082-a582-4947-9a57-41a376356a6e","html_url":"https://github.com/elsoul/fresh-atom","commit_stats":null,"previous_names":["elsoul/fresh-atom"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/elsoul/fresh-atom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsoul%2Ffresh-atom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsoul%2Ffresh-atom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsoul%2Ffresh-atom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsoul%2Ffresh-atom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elsoul","download_url":"https://codeload.github.com/elsoul/fresh-atom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsoul%2Ffresh-atom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["deno","fresh","preact"],"created_at":"2024-10-25T15:40:35.746Z","updated_at":"2026-05-09T04:33:21.186Z","avatar_url":"https://github.com/elsoul.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@elsoul/fresh-atom`\n\n`@elsoul/fresh-atom` is a lightweight global state management library inspired\nby Recoil and Jotai, specifically designed for use in\n[Deno's Fresh framework](https://fresh.deno.dev/).\n\nLeveraging Preact's `signal` under the hood, it enables efficient state updates\nand reactivity, ideal for edge-native applications.\n\n## Features\n\n- **Lightweight**: Minimal API surface with `atom` and `useAtom`, similar to\n  Jotai.\n- **Preact Integration**: Powered by Preact's `signal` for performance-optimized\n  reactivity.\n- **Edge-Native**: Designed to run on Deno, providing TypeScript-first\n  development with modern performance standards.\n\n## Installation\n\nTo install and use `@elsoul/fresh-atom` in your project, you can import it\ndirectly from the JavaScript Standard Registry (JSR) or from the Deno land:\n\n### Using JSR\n\n```ts\nimport { atom, useAtom } from 'jsr:@elsoul/fresh-atom'\n```\n\n### Using Deno Land\n\n```ts\nimport { atom, useAtom } from 'https://deno.land/x/fresh_atom/mod.ts'\n```\n\n## Usage\n\n`@elsoul/fresh-atom` allows you to create shared state in your Fresh application\nwith minimal effort. Here's how you can create and use atoms.\n\n### Creating an Atom\n\nAtoms hold a single piece of state. You can define an atom like this:\n\n```ts\nimport { atom } from '@elsoul/fresh-atom'\n\nconst countAtom = atom(0) // Create an atom with an initial value of 0\n```\n\n### Using an Atom in a Component\n\nTo read and modify the atom's value inside a component, you can use `useAtom`:\n\n```tsx\nimport { useAtom } from '@elsoul/fresh-atom'\n\nexport default function Counter() {\n  const [count, setCount] = useAtom(countAtom)\n\n  return (\n    \u003cdiv\u003e\n      \u003cp\u003eCount: {count}\u003c/p\u003e\n      \u003cbutton onClick={() =\u003e setCount(count + 1)}\u003eIncrement\u003c/button\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\nThe state will automatically update whenever the atom's value changes, ensuring\nefficient re-rendering.\n\n### Advanced: Async Atom\n\nYou can also define an asynchronous atom that resolves after some operation:\n\n```ts\nimport { atom } from '@elsoul/fresh-atom'\n\nconst asyncAtom = atom(async () =\u003e {\n  const data = await fetchData()\n  return data\n})\n```\n\nYou can then use `useAtom` in the same way to handle asynchronous state.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/elsoul/fresh-atom This project is intended to be a safe,\nwelcoming space for collaboration, and contributors are expected to adhere to\nthe [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe package is available as open source under the terms of the\n[Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).\n\n## Code of Conduct\n\nEveryone interacting in the SKEET project’s codebases, issue trackers, chat\nrooms and mailing lists is expected to follow the\n[code of conduct](https://github.com/elsoul/skeet/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsoul%2Ffresh-atom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felsoul%2Ffresh-atom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsoul%2Ffresh-atom/lists"}