{"id":18665643,"url":"https://github.com/gawsoftpl/grpc-js-reflection-api-client","last_synced_at":"2026-04-30T22:01:03.125Z","repository":{"id":57254506,"uuid":"454536252","full_name":"gawsoftpl/grpc-js-reflection-api-client","owner":"gawsoftpl","description":"Package use Grpc reflection api to download gprc proto descriptor. Now you don't have to add proto file  to each package. Simple direct download proto package from example microservice without any files","archived":false,"fork":false,"pushed_at":"2026-04-18T20:01:17.000Z","size":10141,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-18T21:31:14.654Z","etag":null,"topics":["client","grpc","nodejs","reflection","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/gawsoftpl.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-01T20:14:33.000Z","updated_at":"2026-04-18T20:01:14.000Z","dependencies_parsed_at":"2023-11-13T22:25:37.814Z","dependency_job_id":"97d1cf1d-43e1-499d-96c5-2128af52ec01","html_url":"https://github.com/gawsoftpl/grpc-js-reflection-api-client","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":0.09999999999999998,"last_synced_commit":"cf178f12748cc92a48599a8d3d52439e506a738a"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"purl":"pkg:github/gawsoftpl/grpc-js-reflection-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawsoftpl%2Fgrpc-js-reflection-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawsoftpl%2Fgrpc-js-reflection-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawsoftpl%2Fgrpc-js-reflection-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawsoftpl%2Fgrpc-js-reflection-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gawsoftpl","download_url":"https://codeload.github.com/gawsoftpl/grpc-js-reflection-api-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawsoftpl%2Fgrpc-js-reflection-api-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32478162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["client","grpc","nodejs","reflection","typescript"],"created_at":"2024-11-07T08:28:30.762Z","updated_at":"2026-04-30T22:01:03.078Z","avatar_url":"https://github.com/gawsoftpl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Title\nReflection client for Node/Typescript for @grpc/grpc-js. Working with @grpc/reflection server and other grpc nodejs servers.\n\n# About\nPackage use Grpc reflection api to download gprc proto descriptor. Now you don't have to add proto file\nto each package. Simple direct download proto package from example microservice without any files.\n\n# Upgrades Protobufjs\n- If you want to use `protobufjs \u003e= 8.x.x` use `grpc-js-reflection-client \u003e= 1.4`\n- If you want to use `protobufjs 7.x.x` use `grpc-js-reflection-client \u003c 1.4`\n\n## Install\n```sh\nnpm install grpc-js-reflection-client @grpc/grpc-js\n```\n\nor\n```\nyarn add grpc-js-reflection-client @grpc/grpc-js\n```\n\n## How to use\n\n### List services Without tls\n```js\nconst { GrpcReflection } = require('grpc-js-reflection-client');\nconst grpc =  require('@grpc/grpc-js');\n\n/**\n * List services\n */\ntry {\n    (async () =\u003e {\n        const c = new GrpcReflection(\n            '0.0.0.0:50051',\n            grpc.ChannelCredentials.createInsecure(),\n            // {\n            //     \"grpc.max_connection_age_ms\": 10*1000,\n            //     'grpc.keepalive_time_ms': 10 * 1000,\n            //     // Keepalive ping timeout after 5 seconds, default is 20 seconds.\n            //     'grpc.keepalive_timeout_ms': 5 * 1000,\n            //     // Allow keepalive pings when there are no gRPC calls.\n            //     'grpc.keepalive_permit_without_calls': 1,\n            //     \"grpc.initial_reconnect_backoff_ms\": 1000,\n            // }\n        );\n        console.log(await c.listServices());\n    })();\n\n}catch(e){\n    console.log(e);\n}\n\n```\n\n### List services with TLS\n```js\nconst { GrpcReflection } = require('grpc-js-reflection-client');\nconst grpc =  require('@grpc/grpc-js');\n\nfunction getChannelCredentials() {\n    return grpc.ChannelCredentials.createSsl();\n}\n\ntry {\n    (async()=\u003e {\n        const client = new GrpcReflection(\n            'grpcb.in:9001',\n            getChannelCredentials(),\n        );\n        console.log(await client.listServices());\n    })();\n}catch(e){\n    console.log(e)\n}\n```\n\n### List methods for service\n```js\nconst { GrpcReflection } = require('grpc-js-reflection-client');\nconst grpc =  require('@grpc/grpc-js');\n\nfunction getChannelCredentials() {\n    return grpc.ChannelCredentials.createSsl();\n}\n\ntry {\n    (async()=\u003e {\n        const client = new GrpcReflection(\n            'grpcb.in:9001',\n            getChannelCredentials(),\n        );\n\n        const methods = await client.listMethods('grpc.gateway.examples.examplepb.ABitOfEverythingService');\n        console.log(methods.map(method =\u003e method.name));\n    })();\n}catch(e){\n    console.log(e)\n}\n```\n\n## Example client + server\n\n#### 1. Server with @grpc/reflection\n```js\ncat \u003c\u003cEOF \u003e server.js\nconst grpc = require('@grpc/grpc-js');\nconst { ReflectionService } = require('@grpc/reflection');\nconst protoLoader = require('@grpc/proto-loader');\n\nconst def_options =  {\n    keepCase: true,\n    longs: String,\n    enums: String,\n    defaults: true,\n    oneofs: true\n};\n\nconst packageDefinition = protoLoader.loadSync(\n    __dirname + 'addressbook.proto', // https://raw.githubusercontent.com/gawsoftpl/grpc-js-reflection-api-client/main/tests/protos/addressbook.proto\n    def_options\n);\nconst addressbook = grpc.loadPackageDefinition(packageDefinition)\n\n// This wraps the instance of gRPC server with the Server Reflection service and returns it.\nconst server = new grpc.Server();\n\nconst reflection = new ReflectionService(packageDefinition);\nreflection.addToServer(server);\n\nserver.addService(\n    //@ts-ignore\n    addressbook.addressbook.AddressesService.service, {\n        Add: (_, callback) =\u003e {\n            callback(null, {\n                success: true,\n                id: \"123\"\n            });\n        }\n    }\n)\n\nserver.bindAsync(\"127.0.0.1:3000\", grpc.ServerCredentials.createInsecure(),() =\u003e {\n    server.start();\n    console.log(\"Server started on port 3000\");\n});\nEOF\n```\n\n#### 2. Client with grpc-js-reflection-client\n```js\ncat \u003c\u003cEOF \u003e client.js\nconst { GrpcReflection } = require('grpc-js-reflection-client');\nconst grpc =  require('@grpc/grpc-js');\n\n/**\n * Get proto descriptor from reflection grpc api and get in @grpc/grpc-js format\n *\n * */\n\nconst host = \"127.0.0.1:3000\"\n\ntry {\n    (async()=\u003e{\n        // Connect with grpc server reflection\n        const client = new GrpcReflection(host, grpc.ChannelCredentials.createInsecure());\n\n        // Get services without proto file for specific symbol or file name\n        const descriptor = await client.getDescriptorByFileName('addressbook.proto');\n\n        // Create package services\n        const packageObject = descriptor.getPackageObject({\n            keepCase: true,\n            enums: String,\n            longs: String\n        });\n\n        // Send request over grpc\n        const proto = new packageObject.addressbook.AddressesService(\n            host,\n            grpc.ChannelCredentials.createInsecure(),\n        );\n\n        proto.Add({\n            name: \"abc\",\n            email: \"test@example.com\"\n        },(err,data)=\u003e{\n            if(err) {\n                console.log(err);\n            }else{\n                console.log(data);\n            }\n        });\n\n    })();\n}catch(e){\n    console.log(e);\n}\nEOF\n```\n\n#### 3. Run script\nRun both commands in seperate terminal\n```sh\nnode server.js\n```\n```sh\nnode client.js\n```\n\n## Helpers functions\nYou can use one line helpers function for simple download service from grpc reflection server and run client:\n```js\nconst { serviceHelper } = require('grpc-js-reflection-client');\nconst grpc =  require('@grpc/grpc-js');\n\n(async()=\u003e{\n    const proto = await serviceHelper({\n        host: \"localhost:50053\",\n        servicePath: \"addressbook.AddressesService\",\n        credentials: grpc.ChannelCredentials.createInsecure(),\n        proto_filename: 'addressbook.proto',\n        protoLoaderOptions: {\n            keepCase: true\n        }\n    })\n\n    proto.Add({\n        name: \"abc\",\n        email: \"test@example.com\"\n    }, (err, response) =\u003e {\n        console.log(response)\n    });\n})();\n\n```\n\n## Tests\n\n### Unit tests\n```sh\nnpm run test\n```\n\n### E2E tests\n```sh\nbin/start-e2e-test-server.sh\nnpm run test:e2e\n```\n\n## Proto bindings\n\nProto bindings were generated for v1 and v1alpha reflection using the following commands\n\n```sh\nsudo apt update\nsudo apt install -y protobuf-compiler\nnpm install -g protoc-gen-ts\nprotoc -I=proto/ --ts_out=src/Proto v1.proto --ts_opt=json_names\nprotoc -I=proto/ --ts_out=src/Proto v1alpha.proto --ts_opt=json_names\n```\n\n## Nodejs Grpc reflection server\nIf you want to use grpc reflection server in NodeJS/Typescript use below package:\n[https://www.npmjs.com/package/@grpc/reflection](https://www.npmjs.com/package/@grpc/reflection)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawsoftpl%2Fgrpc-js-reflection-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgawsoftpl%2Fgrpc-js-reflection-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawsoftpl%2Fgrpc-js-reflection-api-client/lists"}