{"id":18150042,"url":"https://github.com/go-kod/grpc-gateway","last_synced_at":"2025-04-27T07:18:11.792Z","repository":{"id":249633476,"uuid":"824409283","full_name":"go-kod/grpc-gateway","owner":"go-kod","description":"A simple gateway that can be used to expose multiple gRPC services as a GraphQL/HTTP server.","archived":false,"fork":false,"pushed_at":"2025-04-14T09:47:21.000Z","size":2009,"stargazers_count":38,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-27T07:18:03.594Z","etag":null,"topics":["gateway","go","graphql","grpc","http","json","microservice","opentelemetry"],"latest_commit_sha":null,"homepage":"","language":"Go","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/go-kod.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":"2024-07-05T04:41:45.000Z","updated_at":"2025-03-08T21:12:12.000Z","dependencies_parsed_at":"2024-07-22T11:29:53.522Z","dependency_job_id":"2320364b-c0ef-4f8f-86ea-ee4e81605c6a","html_url":"https://github.com/go-kod/grpc-gateway","commit_stats":null,"previous_names":["sysulq/graphql-grpc-gateway","go-kod/grpc-gateway"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kod%2Fgrpc-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kod%2Fgrpc-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kod%2Fgrpc-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kod%2Fgrpc-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-kod","download_url":"https://codeload.github.com/go-kod/grpc-gateway/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251099763,"owners_count":21536159,"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":["gateway","go","graphql","grpc","http","json","microservice","opentelemetry"],"created_at":"2024-11-02T00:07:16.385Z","updated_at":"2025-04-27T07:18:11.774Z","avatar_url":"https://github.com/go-kod.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gRPC gateway\n\n[![Build and Test](https://github.com/go-kod/grpc-gateway/actions/workflows/go.yml/badge.svg)](https://github.com/go-kod/grpc-gateway/actions/workflows/go.yml)\n[![codecov](https://codecov.io/gh/go-kod/grpc-gateway/graph/badge.svg?token=UO18DMG15Z)](https://codecov.io/gh/go-kod/grpc-gateway)\n\nThis is a simple gateway that can be used to expose multiple gRPC services as a GraphQL/HTTP server.\n\n![arch](./assets//arch.excalidraw.png)\n\n## Pre-requisites\n\n- [Task](https://taskfile.dev/#/installation)\n- [Docker](https://docs.docker.com/get-docker/)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n- [Go](https://golang.org/doc/install)\n\n## Installation\n\nTo install the dependencies, run the following command:\n\n```bash\ndocker-compose -f \"deployment/docker-compose.yml\" up -d\n```\n\n## Getting started\n\nTo start the gateway, run the following command:\n\n```bash\ntask run\n```\n\n```text\ntask: [optionsserver] go run ./example/gateway/optionsserver\ntask: [gateway] KOD_CONFIG=./example/gateway/config.yaml go run ./cmd/gateway\ntask: [constructsserver] go run ./example/gateway/constructsserver\n2024/07/18 19:53:26 INFO grpc server started on: [::]:8082\n2024/07/18 19:53:26 INFO grpc server started on: [::]:8081\n2024/07/18 19:53:26 [INFO] Gateway listening on address: [::]:8080\n2024/07/18 19:53:27 INFO Register service key=local/optionsserver/grpc/172.19.43.45:8082\n2024/07/18 19:53:27 INFO Register service key=local/constructsserver/grpc/172.19.43.45:8081\n```\n\n## Test the gateway\n\n```bash\ntask curl\n```\n\n```text\ntask: [curl] curl 'http://localhost:8080/playground' -H 'Content-Type: application/json' --data-binary @test/post2.json -v\n*   Trying 127.0.0.1:8080...\n* Connected to localhost (127.0.0.1) port 8080 (#0)\n\u003e POST /playground HTTP/1.1\n\u003e Host: localhost:8080\n\u003e User-Agent: curl/8.1.2\n\u003e Accept: */*\n\u003e Content-Type: application/json\n\u003e Content-Length: 423\n\u003e \n\u003c HTTP/1.1 200 OK\n\u003c Content-Type: application/json\n\u003c Date: Thu, 18 Jul 2024 11:55:21 GMT\n\u003c Content-Length: 320\n\u003c \n* Connection #0 to host localhost left intact\n{\"data\":{\"serviceQuery1\":{\"float\":[111],\"foo\":{\"param1\":\"para\"},\"string\":\"sdfs\",\"string2\":\"ssdfsd\"},\"serviceQuery2\":{\"float\":[111],\"foo\":{\"param1\":\"para\"},\"string\":\"sdfs\",\"string2\":\"ssdfsd\"}},\"extensions\":{\"persistedQuery\":{\"sha265Hash\":\"5c898c064b9290d7b66dce6267db15478f8cd52e19498cde4b040f0e456e371d\",\"version\":\"1\"}}}\n```\n\n## Benchmark\n\nTo run the benchmark, run the following command:\n\n```bash\ntask bench\n```\n\n```text\ntask: [bench] ab -n 50000 -kc 500 -T 'application/json' -H 'Accept-Encoding: gzip, deflate, br' -p test/post1.json http://localhost:8080/query\nThis is ApacheBench, Version 2.3 \u003c$Revision: 1903618 $\u003e\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking localhost (be patient)\nCompleted 5000 requests\nCompleted 10000 requests\nCompleted 15000 requests\nCompleted 20000 requests\nCompleted 25000 requests\nCompleted 30000 requests\nCompleted 35000 requests\nCompleted 40000 requests\nCompleted 45000 requests\nCompleted 50000 requests\nFinished 50000 requests\n\n\nServer Software:        \nServer Hostname:        localhost\nServer Port:            8080\n\nDocument Path:          /query\nDocument Length:        229 bytes\n\nConcurrency Level:      500\nTime taken for tests:   1.278 seconds\nComplete requests:      50000\nFailed requests:        0\nKeep-Alive requests:    50000\nTotal transferred:      18100000 bytes\nTotal body sent:        21100000\nHTML transferred:       11450000 bytes\nRequests per second:    39131.19 [#/sec] (mean)\nTime per request:       12.778 [ms] (mean)\nTime per request:       0.026 [ms] (mean, across all concurrent requests)\nTransfer rate:          13833.49 [Kbytes/sec] received\n                        16126.33 kb/s sent\n                        29959.82 kb/s total\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   1.6      0      23\nProcessing:     0   12  11.0      9     102\nWaiting:        0   12  11.0      9     102\nTotal:          0   13  11.2      9     102\n\nPercentage of the requests served within a certain time (ms)\n  50%      9\n  66%     13\n  75%     16\n  80%     18\n  90%     28\n  95%     37\n  98%     48\n  99%     53\n 100%    102 (longest request)\n```\n\n## Call Graph\n\n![callgraph](./assets/callgraph.png)\n\n## Pyroscope\n\nVisiting [http://localhost:4040](http://localhost:4040) will show the Pyroscope dashboard.\n\n![pyroscope](./assets/pyroscope.png)\n\n## Uptrace\n\nVisiting [http://localhost:14318/](http://localhost:14318/) will show the Uptrace dashboard.\n\n![uptrace](./assets/uptrace.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-kod%2Fgrpc-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-kod%2Fgrpc-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-kod%2Fgrpc-gateway/lists"}