{"id":13471533,"url":"https://github.com/connectrpc/connect-go","last_synced_at":"2025-05-13T23:06:10.279Z","repository":{"id":37033568,"uuid":"391811592","full_name":"connectrpc/connect-go","owner":"connectrpc","description":"The Go implementation of Connect: Protobuf RPC that works.","archived":false,"fork":false,"pushed_at":"2025-04-17T14:37:04.000Z","size":2964,"stargazers_count":3248,"open_issues_count":23,"forks_count":118,"subscribers_count":34,"default_branch":"main","last_synced_at":"2025-04-18T04:53:38.773Z","etag":null,"topics":["connectrpc","go","grpc","protobuf","rpc"],"latest_commit_sha":null,"homepage":"https://connectrpc.com","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/connectrpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-02T04:08:04.000Z","updated_at":"2025-04-17T20:44:16.000Z","dependencies_parsed_at":"2023-11-14T15:44:05.057Z","dependency_job_id":"8bc353e3-c9a5-4584-9daf-b1c6b81af15f","html_url":"https://github.com/connectrpc/connect-go","commit_stats":{"total_commits":772,"total_committers":46,"mean_commits":"16.782608695652176","dds":0.5077720207253886,"last_synced_commit":"6029bf7150f9564491e7119502645c0c50d9d56d"},"previous_names":["rerpc/rerpc","bufbuild/connect","connectrpc/connect-go","bufconnect/connect"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectrpc%2Fconnect-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectrpc%2Fconnect-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectrpc%2Fconnect-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectrpc%2Fconnect-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/connectrpc","download_url":"https://codeload.github.com/connectrpc/connect-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254040775,"owners_count":22004611,"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":["connectrpc","go","grpc","protobuf","rpc"],"created_at":"2024-07-31T16:00:46.343Z","updated_at":"2025-05-13T23:06:05.264Z","avatar_url":"https://github.com/connectrpc.png","language":"Go","readme":"Connect\n=======\n\n[![Build](https://github.com/connectrpc/connect-go/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/connectrpc/connect-go/actions/workflows/ci.yaml)\n[![Report Card](https://goreportcard.com/badge/connectrpc.com/connect)](https://goreportcard.com/report/connectrpc.com/connect)\n[![GoDoc](https://pkg.go.dev/badge/connectrpc.com/connect.svg)](https://pkg.go.dev/connectrpc.com/connect)\n[![Slack](https://img.shields.io/badge/slack-buf-%23e01563)][slack]\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8972/badge)](https://www.bestpractices.dev/projects/8972)\n\nConnect is a slim library for building browser and gRPC-compatible HTTP APIs.\nYou write a short [Protocol Buffer][protobuf] schema and implement your\napplication logic, and Connect generates code to handle marshaling, routing,\ncompression, and content type negotiation. It also generates an idiomatic,\ntype-safe client. Handlers and clients support three protocols: gRPC, gRPC-Web,\nand Connect's own protocol.\n\nThe [Connect protocol][protocol] is a simple protocol that works over HTTP/1.1\nor HTTP/2. It takes the best portions of gRPC and gRPC-Web, including\nstreaming, and packages them into a protocol that works equally well in\nbrowsers, monoliths, and microservices. Calling a Connect API is as easy as\nusing `curl`. Try it with our live demo:\n\n```\ncurl \\\n    --header \"Content-Type: application/json\" \\\n    --data '{\"sentence\": \"I feel happy.\"}' \\\n    https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say\n```\n\nHandlers and clients also support the gRPC and gRPC-Web protocols, including\nstreaming, headers, trailers, and error details. gRPC-compatible [server\nreflection][grpcreflect] and [health checks][grpchealth] are available as\nstandalone packages. Instead of cURL, we could call our API with a gRPC client:\n\n```\ngo install github.com/bufbuild/buf/cmd/buf@latest\nbuf curl --protocol grpc \\\n    --data '{\"sentence\": \"I feel happy.\"}' \\\n    https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say\n```\n\nUnder the hood, Connect is just [Protocol Buffers][protobuf] and the standard\nlibrary: no custom HTTP implementation, no new name resolution or load\nbalancing APIs, and no surprises. Everything you already know about `net/http`\nstill applies, and any package that works with an `http.Server`, `http.Client`,\nor `http.Handler` also works with Connect.\n\nFor more on Connect, see the [announcement blog post][blog], the documentation\non [connectrpc.com][docs] (especially the [Getting Started] guide for Go), the\n[demo service][examples-go], or the [protocol specification][protocol].\n\n## A small example\n\nCurious what all this looks like in practice? From a [Protobuf\nschema](internal/proto/connect/ping/v1/ping.proto), we generate [a small RPC\npackage](internal/gen/connect/ping/v1/pingv1connect/ping.connect.go). Using that\npackage, we can build a server:\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"log\"\n  \"net/http\"\n\n  \"connectrpc.com/connect\"\n  pingv1 \"connectrpc.com/connect/internal/gen/connect/ping/v1\"\n  \"connectrpc.com/connect/internal/gen/connect/ping/v1/pingv1connect\"\n  \"golang.org/x/net/http2\"\n  \"golang.org/x/net/http2/h2c\"\n)\n\ntype PingServer struct {\n  pingv1connect.UnimplementedPingServiceHandler // returns errors from all methods\n}\n\nfunc (ps *PingServer) Ping(\n  ctx context.Context,\n  req *connect.Request[pingv1.PingRequest],\n) (*connect.Response[pingv1.PingResponse], error) {\n  // connect.Request and connect.Response give you direct access to headers and\n  // trailers. No context-based nonsense!\n  log.Println(req.Header().Get(\"Some-Header\"))\n  res := connect.NewResponse(\u0026pingv1.PingResponse{\n    // req.Msg is a strongly-typed *pingv1.PingRequest, so we can access its\n    // fields without type assertions.\n    Number: req.Msg.Number,\n  })\n  res.Header().Set(\"Some-Other-Header\", \"hello!\")\n  return res, nil\n}\n\nfunc main() {\n  mux := http.NewServeMux()\n  // The generated constructors return a path and a plain net/http\n  // handler.\n  mux.Handle(pingv1connect.NewPingServiceHandler(\u0026PingServer{}))\n  err := http.ListenAndServe(\n    \"localhost:8080\",\n    // For gRPC clients, it's convenient to support HTTP/2 without TLS. You can\n    // avoid x/net/http2 by using http.ListenAndServeTLS.\n    h2c.NewHandler(mux, \u0026http2.Server{}),\n  )\n  log.Fatalf(\"listen failed: %v\", err)\n}\n```\n\nWith that server running, you can make requests with any gRPC or Connect\nclient. To write a client using Connect,\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"log\"\n  \"net/http\"\n\n  \"connectrpc.com/connect\"\n  pingv1 \"connectrpc.com/connect/internal/gen/connect/ping/v1\"\n  \"connectrpc.com/connect/internal/gen/connect/ping/v1/pingv1connect\"\n)\n\nfunc main() {\n  client := pingv1connect.NewPingServiceClient(\n    http.DefaultClient,\n    \"http://localhost:8080/\",\n  )\n  req := connect.NewRequest(\u0026pingv1.PingRequest{\n    Number: 42,\n  })\n  req.Header().Set(\"Some-Header\", \"hello from connect\")\n  res, err := client.Ping(context.Background(), req)\n  if err != nil {\n    log.Fatalln(err)\n  }\n  log.Println(res.Msg)\n  log.Println(res.Header().Get(\"Some-Other-Header\"))\n}\n```\n\nOf course, `http.ListenAndServe` and `http.DefaultClient` aren't fit for\nproduction use! See Connect's [deployment docs][docs-deployment] for a guide to\nconfiguring timeouts, connection pools, observability, and h2c.\n\n## Ecosystem\n\n* [grpchealth]: gRPC-compatible health checks\n* [grpcreflect]: gRPC-compatible server reflection\n* [examples-go]: service powering demo.connectrpc.com, including bidi streaming\n* [connect-es]: Type-safe APIs with Protobuf and TypeScript\n* [Buf Studio]: web UI for ad-hoc RPCs\n* [conformance]: Connect, gRPC, and gRPC-Web interoperability tests\n\n## Status: Stable\n\nThis module is stable. It supports:\n\n* The two most recent major releases of Go (the same versions of Go that continue\n  to [receive security patches][go-support-policy]).\n* [APIv2] of Protocol Buffers in Go (`google.golang.org/protobuf`).\n\nWithin those parameters, `connect` follows semantic versioning. We will\n_not_ make breaking changes in the 1.x series of releases.\n\n## Legal\n\nOffered under the [Apache 2 license][license].\n\n[APIv2]: https://blog.golang.org/protobuf-apiv2\n[Buf Studio]: https://buf.build/studio\n[Getting Started]: https://connectrpc.com/docs/go/getting-started\n[blog]: https://buf.build/blog/connect-a-better-grpc\n[conformance]: https://github.com/connectrpc/conformance\n[grpchealth]: https://github.com/connectrpc/grpchealth-go\n[grpcreflect]: https://github.com/connectrpc/grpcreflect-go\n[connect-es]: https://github.com/connectrpc/connect-es\n[examples-go]: https://github.com/connectrpc/examples-go\n[docs-deployment]: https://connectrpc.com/docs/go/deployment\n[docs]: https://connectrpc.com\n[go-support-policy]: https://golang.org/doc/devel/release#policy\n[license]: https://github.com/connectrpc/connect-go/blob/main/LICENSE\n[protobuf]: https://developers.google.com/protocol-buffers\n[protocol]: https://connectrpc.com/docs/protocol\n[slack]: https://buf.build/links/slack\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnectrpc%2Fconnect-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconnectrpc%2Fconnect-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnectrpc%2Fconnect-go/lists"}