{"id":23806791,"url":"https://github.com/webrpc/react-query-adapter","last_synced_at":"2026-02-17T01:02:36.484Z","repository":{"id":97513044,"uuid":"546638869","full_name":"webrpc/react-query-adapter","owner":"webrpc","description":"webrpc adapter for react-query","archived":false,"fork":false,"pushed_at":"2024-04-26T01:22:28.000Z","size":226,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T17:46:43.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/webrpc.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":"2022-10-06T12:03:19.000Z","updated_at":"2025-03-21T23:24:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0a5c228-55e5-470c-aba1-997190ca0977","html_url":"https://github.com/webrpc/react-query-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/webrpc/react-query-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Freact-query-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Freact-query-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Freact-query-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Freact-query-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webrpc","download_url":"https://codeload.github.com/webrpc/react-query-adapter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Freact-query-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29528243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T00:57:22.232Z","status":"ssl_error","status_checked_at":"2026-02-17T00:54:25.811Z","response_time":115,"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-01-01T23:14:49.600Z","updated_at":"2026-02-17T01:02:36.017Z","avatar_url":"https://github.com/webrpc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"@webrpc/react-query -- a react-query adapter for webrpc\n=======================================================\n\nEnjoy the RPC code-gen ergonomics + type-safety benefits of webrpc, with the comfort\nof react-query from your React apps :) \n\n\n## Install\n\nFrom your webapps: `npm install @webrpc/react-query`\n\nAs well, make sure you install `@tanstack/react-query` and `react` in your app, which are\npeer-dependencies of this library.\n\n\n## Example\n\nPlease see a full example project with both server and client [here](./example).\n\nTo run the example:\n\n1. git clone this repo\n2. `cd example/webapp`\n3. `pnpm install`\n4. Start the server -- in one terminal: `make run-server`\n5. Start the webapp -- in another terminal: `make run-webapp`\n6. Open the webapp at http://localhost:4444 and open your browser console\n\n\n## How to use\n\nFirst, you'll need a webrpc schema definition either in JSON or RIDL.\n\nThen create an instance of your RPC client and pass it as an argument to the WebRpcClient constructor.\nIt should look something like this:\n\n```ts\nimport { Example } from './client.gen'\nimport { WebRpcQueryClient } from '@webrpc/react-query'\n\nconst rpc = new Example('http://localhost:4242', fetch)\nconst client = new WebRpcQueryClient(rpc)\n```\n\nImport `client` where you need to make your API calls and let type inference guide your way!\n\n\n## Differentiating queries and mutations\n\nIf you want to make the distinction between a query and a mutation even clearer, you can define custom _query prefixes_.\nYou do so by adding a generic type to your `WebRpcClient` instance.\n\n```ts\nimport { Example } from './client.gen'\nimport { WebRpcQueryClient } from '@webrpc/react-query'\n\nconst rpc = new Example('http://localhost:4242', fetch)\nconst client = new WebRpcQueryClient\u003ctypeof rpc, ['get', 'list']\u003e(rpc)\n```\n\nWith this configuration, you can only use `client.useQuery` hook with paths that start with either `'get'` or `'list'`.\n\nAny other method from your contract will be considered a _mutation_. If you choose not to provide _query prefixes_, you will be able to call both `client.useQuery` and `client.useMutation` with any path from your contract.\n\n\n## Local dev\n\nYou can update `example/webapp/package.json` package to `\"@webrpc/react-query\": \"workspace:../../\"`\nwhich will use the build from the local repo.\n\n\n## Credits\n\nThank you to @vojoup from the github.com/golang-cz team for the idea and original implementation of this library :)\n\n\n## LICENSE\n\nLicensed under [MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebrpc%2Freact-query-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebrpc%2Freact-query-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebrpc%2Freact-query-adapter/lists"}