{"id":24455549,"url":"https://github.com/nixjs/grpc-client-toolkit","last_synced_at":"2025-04-13T02:29:32.500Z","repository":{"id":54943872,"uuid":"509627069","full_name":"nixjs/grpc-client-toolkit","owner":"nixjs","description":"gRPC Client is the port of gRPC-Web library. For making gRPC requests from a browser.","archived":false,"fork":false,"pushed_at":"2023-10-05T08:25:03.000Z","size":3461,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T17:49:54.338Z","etag":null,"topics":["grpc","grpc-client","grpc-react","grpc-web","protobuf","protobufjs","react","typescript"],"latest_commit_sha":null,"homepage":"https://grpc-client-toolkit.vercel.app/","language":"SCSS","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/nixjs.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":"2022-07-02T01:16:22.000Z","updated_at":"2022-12-10T09:00:22.000Z","dependencies_parsed_at":"2022-08-14T07:10:42.582Z","dependency_job_id":"7e7eb6fa-4b66-40e5-a6eb-63b92c11c92e","html_url":"https://github.com/nixjs/grpc-client-toolkit","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.06666666666666665,"last_synced_commit":"9a9b26c3f5aba855f123d5bf7acc19279ac965f1"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixjs%2Fgrpc-client-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixjs%2Fgrpc-client-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixjs%2Fgrpc-client-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixjs%2Fgrpc-client-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nixjs","download_url":"https://codeload.github.com/nixjs/grpc-client-toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657732,"owners_count":21140839,"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":["grpc","grpc-client","grpc-react","grpc-web","protobuf","protobufjs","react","typescript"],"created_at":"2025-01-21T02:13:43.216Z","updated_at":"2025-04-13T02:29:32.474Z","avatar_url":"https://github.com/nixjs.png","language":"SCSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# #gRpc Client\n\ngRPC for Web Clients.\n\n### Install\n\nInstall these dependencies:\n\n`yarn add @nixjs23n6/grpc-core`\n\n### Setup \u0026 Usage\n\n```javascript\nimport { Client } from \"@nixjs23n6/grpc-core\";\nimport * as pbjs from \"google-protobuf/google/protobuf/empty_pb\";\nimport { ExampleClient } from \"@example-proto/example_grpc_web_pb\";\n\nconst grpcInstance = new Client({ url: \"https://example.nixjs\" });\n\ngrpcInstance.connect(ExampleClient, false);\n\ngrpcInstance.interceptorHeader(\n  (config: any) =\u003e {\n    return config;\n  },\n  (error: any) =\u003e {\n    return Promise.resolve(error);\n    // return Promise.reject(error)\n  }\n);\ngrpcInstance.interceptorResponse(\n  (response: any) =\u003e {\n    return response;\n    // return response \u0026\u0026 response.toObject()\n  },\n  (error: any) =\u003e {\n    return Promise.resolve(error);\n    // return Promise.reject(error)\n  }\n);\n\ngrpcInstance.configure();\n\ngrpcInstance\n  .send(\"getExample\", new pbjs.Empty())\n  .then((res: any) =\u003e console.log(res));\n```\n\n# #gRPC Client React\n\nA react context which helps you to deal with gRPC web.\n\n### Install\n\nInstall these dependencies:\n\n`yarn add @nixjs23n6/grpc-core @nixjs23n6/grpc-react`\n\n### Setup\n\n```javascript\nimport React, { FC } from 'react';\nimport { GRPCProvider, ClientServiceSourceProps } from '@nixjs23n6/grpc-react'\nimport { ExampleClient1 } from '@example-proto/example_grpc_web_pb1'\nimport { ExampleClient2 } from '@example-proto/example_grpc_web_pb2'\nimport { ExampleClient3 } from '@example-proto/example_grpc_web_pb3'\n\nconst ClientServices: ClientServiceSourceProps[] = [\n    {\n        key: 'client1',\n        source: ExampleClient1,\n        config: { // optionals\n            url: 'https://example.nixjs',\n        },\n    },\n    {\n        key: 'client2',\n        source: ExampleClient2,\n        config: { // optionals\n            promiseType: true,\n            storeKey: 'sessionAccessToken',\n            storeType: 'session',\n        },\n    },\n    {\n        key: 'client3',\n        source: ExampleClient3,\n        config: { // optionals\n            promiseType: true,\n        },\n    },\n]\n\ninterface AppPropArg = {}\n\nexport const App: FC\u003cAppPropArg\u003e = () =\u003e {\n    return (\n        \u003cGRPCProvider\n        url=\"https://tech.example.nixjs\"\n        ClientServices={ClientServices}\n        promiseType={false}\n        logger={{ debug: true }}\u003e\n            \u003cGrpcComponent/\u003e\n            { /* Your app's components go here, nested within the context providers. */ }\n        \u003c/GRPCProvider\u003e\n    );\n};\n\n```\n\n### Usage\n\n```javascript\nimport React, { FC, useEffect } from 'react';\nimport { useGRPC } from '@nixjs23n6/grpc-react'\nimport * as pbjs from 'google-protobuf/google/protobuf/empty_pb'\n\ninterface GRPCPropArg = {}\n\nexport const GRPCComponent: FC\u003cGRPCPropArg\u003e = () =\u003e {\n    const context = useGRPC()\n\n    console.log('GRPC context', context)\n\n    useEffect(() =\u003e {\n        if (instance) {\n            context.paymentClient.send('getExample1', new pbjs.Empty(), { authorization:'AccessToken'})\n            .then((res: any) =\u003e {\n                console.log('🚀 Response', res)\n            })\n            context.landingPageClient.send('getExample2', new pbjs.Empty()).then((res: any) =\u003e console.log(res))\n        }\n    }, [instance])\n\n    return (\u003cdiv\u003e\n        { /* Your app's components go here, nested within the context providers. */ }\n    \u003c/div\u003e)\n};\n```\n\n# #Reference \u0026 Example\n\nVisit: \u003chttps://grpc-client-toolkit.vercel.app/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixjs%2Fgrpc-client-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnixjs%2Fgrpc-client-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixjs%2Fgrpc-client-toolkit/lists"}