{"id":28097973,"url":"https://github.com/yieldstudio/react-query-factory","last_synced_at":"2026-04-16T11:02:22.274Z","repository":{"id":244392496,"uuid":"616919842","full_name":"YieldStudio/react-query-factory","owner":"YieldStudio","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-24T09:18:59.000Z","size":166,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T10:54:29.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/YieldStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-03-21T10:57:33.000Z","updated_at":"2025-07-24T09:19:03.000Z","dependencies_parsed_at":"2025-05-13T17:45:50.371Z","dependency_job_id":"973052f5-993e-4ab1-b53c-bbd8529498b1","html_url":"https://github.com/YieldStudio/react-query-factory","commit_stats":null,"previous_names":["yieldstudio/react-query-factory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/YieldStudio/react-query-factory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YieldStudio%2Freact-query-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YieldStudio%2Freact-query-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YieldStudio%2Freact-query-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YieldStudio%2Freact-query-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YieldStudio","download_url":"https://codeload.github.com/YieldStudio/react-query-factory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YieldStudio%2Freact-query-factory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2025-05-13T17:45:44.505Z","updated_at":"2026-04-16T11:02:22.249Z","avatar_url":"https://github.com/YieldStudio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @yieldstudio/react-query-factory\n\nOur typesafe factories for [React Query](https://tanstack.com) protected by [Zod](https://zod.dev)\n\n[![Latest Version](https://img.shields.io/github/release/yieldstudio/react-query-factory?style=flat-square)](https://github.com/yieldstudio/react-query-factory/releases)\n[![Total Downloads](https://img.shields.io/npm/dt/@yieldstudio/react-query-factory?style=flat-square)](https://www.npmjs.com/package/@yieldstudio/react-query-factory)\n\n## Getting Started\n\n### Installation\n\nYou can install React Query via [NPM](https://npmjs.com)\n\n```sh\nyarn add --dev @yieldstudio/react-query-factory\n```\n\n### APIs\n\n| API | Description |\n| ----- | ----- |\n| [createQuery](#createquery) | Create a QueryFunction used to create a React Query hook |\n| [createMutation](#createmutation) | Create a MutationFunction used to create a React Query hook |\n| setAxiosInstance | Use to provide a custom axios instance that will be used by factories |\n| getAxiosInstance | Get the axios instance used by the factories |\n| TypedFormData | Polyfill for FormData Generic |\n\n### Quick Start\n\nCreate a client and provide him to your App\n\n```tsx\nimport {\n  QueryClient,\n  QueryClientProvider,\n  setAxiosInstance,\n} from '@yieldstudio/react-query-factory';\nimport { axios } from \"@utils/axios\";\n\nconst queryClient = new QueryClient();\n\nfunction App() {\n  setAxiosInstance(axios); // optional\n\n  return (\n    \u003cQueryClientProvider client={queryClient}\u003e\n      {/* my app */}\n    \u003c/QueryClientProvider\u003e\n  );\n}\n```\n\n#### createQuery\n\nCreate a React Query hook with our createQuery factory\n\n```tsx\nimport { useQuery, createQuery } from '@yieldstudio/react-query-factory';\nimport { array, object, string } from 'zod';\nimport { QUERY_CACHE_KEY } from '@constants/QueryCacheKey';\n\nconst schema = object({\n  data: array({\n    id: string(),\n    label: string(),\n  }),\n});\n\nexport const queryFn = createQuery(schema);\n\nexport function useTodosQuery() {\n  const queryKey = QUERY_CACHE_KEY.todos.list());\n  return useQuery({ queryKey, queryFn });\n}\n```\n\n##### Usage\n\n```tsx\nconst { data, isLoading, ... } = useTodosQuery();\n// data -\u003e { data: Array\u003c{ id: string; label: string }\u003e }\n```\n\n#### createMutation\n\nCreate a React Query mutation hook with our createMutation factory\n\n```tsx\nimport { useMutation, createMutation } from '@yieldstudio/react-query-factory';\nimport { object, string } from 'zod';\n\nconst schema = object({\n  id: string(),\n  label: string(),\n});\n\ntype OrderInput = {\n  label: string;\n};\n\nconst mutationFn = createMutation\u003cOrderInput, typeof schema\u003e('POST', '/v1/todos', schema);\n\nexport function useCreateTodoMutation() {\n  return useMutation(mutationFn);\n}\n\n```\n\n##### Usage\n\n```tsx\nconst { mutateAsync } = useCreateTodoMutation();\nconst data = await mutateAsync({ label: 'my todo label' });\n// data -\u003e { id: string, label: string }\n```\n\n## Credits\n\nPowered by [Yield Studio](https://www.yieldstudio.fr/) team members\n\n- [James Hemery](https://github.com/jameshemery)\n- [Julien Sanchez-Porro](https://github.com/qwisty)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyieldstudio%2Freact-query-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyieldstudio%2Freact-query-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyieldstudio%2Freact-query-factory/lists"}