{"id":25625063,"url":"https://github.com/lqs/grpcmix","last_synced_at":"2026-02-13T01:38:22.960Z","repository":{"id":65662291,"uuid":"596435869","full_name":"lqs/grpcmix","owner":"lqs","description":"🍦 serving gRPC \u0026 gRPC-Web \u0026 HTTP on the same port","archived":false,"fork":false,"pushed_at":"2024-12-26T03:39:21.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-04T00:18:41.774Z","etag":null,"topics":["go","golang","grpc","grpc-web"],"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/lqs.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":"2023-02-02T07:11:30.000Z","updated_at":"2025-01-12T09:10:06.000Z","dependencies_parsed_at":"2024-04-03T06:23:45.596Z","dependency_job_id":"29590d11-4d9a-4310-8758-f0a0852b6884","html_url":"https://github.com/lqs/grpcmix","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/lqs/grpcmix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqs%2Fgrpcmix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqs%2Fgrpcmix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqs%2Fgrpcmix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqs%2Fgrpcmix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lqs","download_url":"https://codeload.github.com/lqs/grpcmix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqs%2Fgrpcmix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270359864,"owners_count":24570569,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","golang","grpc","grpc-web"],"created_at":"2025-02-22T13:43:44.858Z","updated_at":"2026-02-13T01:38:17.942Z","avatar_url":"https://github.com/lqs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grpcmix: serving gRPC, gRPC-Web, and HTTP on a single port\n\ngrpcmix is a convenient Golang library that enables you to run gRPC, gRPC-Web, and HTTP services on a single port easily.\n\n## Motivation\n\nIn many scenarios, you may want to run both gRPC and HTTP on the same service. For example, you may want to provide gRPC services while exposing Prometheus metrics through HTTP endpoints. In other instances, you may need to convert a gRPC service into gRPC-Web to allow it to be accessed from web browsers, which typically requires additional deployment and is not straightforward.\n\nWith grpcmix, you can run all of these protocols on the same port, eliminating the need for multiple ports or extra components to be set up and deployed.\n\n## Features\n\n- Integrated gRPC-Web support (using [improbable-eng/grpc-web](https://github.com/improbable-eng/grpc-web))\n- Single port serving for gRPC, gRPC-Web, and HTTP\n- gRPC-Web with Brotli \u0026 gzip compression (using [andybalholm/brotli](https://github.com/andybalholm/brotli))\n- Graceful shutdown with configurable delay\n\n## Usage\n\nInstall grpcmix:\n```shell\ngo get github.com/lqs/grpcmix\n```\n\nAdd the following lines to your code:\n```go\n// create a grpcmix server\nmixServer := grpcmix.NewServer(grpcmix.Config{\n    Port:          8080,\n    ShutdownDelay: 2 * time.Second,\n}, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n    w.Write([]byte(\"add your http handler here, like prometheus metrics, health check, ...\"))\n}))\n\n// register your grpc services\nyourservicepb.RegisterYourServiceServer(mixServer, YourServiceImpl{})\n\n// start the server and let it gracefully shutdown on SIGTERM\nctx, _ := signal.NotifyContext(context.Background(), syscall.SIGTERM)\nif err := mixServer.StartAndWait(ctx); err != nil {\n    // server start failed\n    panic(err)\n}\n```\n\nWith these few lines of code, you can start a production-ready server that serves gRPC (over HTTP/2), gRPC-Web (over HTTP/1.x \u0026 HTTP/2, with brotli compression), and HTTP (over HTTP/1.x \u0026 HTTP/2) on the same port.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqs%2Fgrpcmix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flqs%2Fgrpcmix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqs%2Fgrpcmix/lists"}