Introduction
Connect is a family of libraries for building browser and gRPC-compatible HTTP APIs: you write a short Protocol Buffer schema and implement your application logic, and Connect generates code to handle marshaling, routing, compression, and content type negotiation. It also generates an idiomatic, type-safe client in any supported language.
Production-grade simplicity
Section titled “Production-grade simplicity”Each Connect implementation is focused: just the essential features, built on top of time-tested HTTP libraries and designed to get out of your way. In Go, Connect is just one package, which is short enough to read in an afternoon.
Connect is our vision of production-grade RPC. It’s simple, reliable, and
unobtrusive, because nobody has time to debug overcomplicated networking or
sift through a hundred esoteric options. Under the hood, it’s just Protocol
Buffers and the HTTP client your language already ships: net/http in Go,
fetch in the browser, URLSession on Apple platforms.
Most of all, Connect is stable. We take backward compatibility very seriously: stable implementations follow semantic versioning, so upgrading within a major version will never break your build.
Seamless multi-protocol support
Section titled “Seamless multi-protocol support”Connect servers and clients support three protocols: gRPC, gRPC-Web, and Connect’s own protocol.
-
Connect fully supports the gRPC protocol, including streaming, trailers, and error details. Any gRPC client, in any language, can call a Connect server, and Connect clients can call any gRPC server. We validate our gRPC compatibility with an extended version of Google’s own interoperability tests.
-
Connect also offers direct support for the gRPC-Web protocol used by grpc/grpc-web, without relying on a translating proxy like Envoy.
-
Finally, Connect supports its own protocol: a straightforward HTTP-based protocol that works over HTTP/1.1, HTTP/2, and HTTP/3. It keeps what gRPC and gRPC-Web are good at, including streaming, error details, and metadata, but stays close enough to ordinary HTTP that browsers, proxies, and cURL can all work with it, which makes it equally at home in browsers, monoliths, and microservices. Implementations support JSON and binary Protobuf encodings by default. You can call our live demo service with cURL:
Terminal window curl \--header "Content-Type: application/json" \--data '{"sentence": "I feel happy."}' \https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say
By default, Connect servers support ingress from all three protocols. Clients default to using the Connect protocol, but can switch to gRPC or gRPC-Web with a configuration toggle, requiring no further code changes. The APIs for errors, headers, trailers, and streaming are all protocol-agnostic.
Connect’s Go implementation is stable, and runs in production at Buf and
several other companies. You can get started with connect-go
now.
TypeScript and JavaScript
Section titled “TypeScript and JavaScript”Connect for ECMAScript is stable and covers both ends of the stack. Get started in the browser on the web, or on the server with Node.js.
Swift and Kotlin
Section titled “Swift and Kotlin”For mobile applications, connect-swift (stable) and
connect-kotlin (beta) are available. Get started today
with our Swift guide and Kotlin
guide.
Connect for Dart is stable, for Flutter applications and server-side Dart alike. Get started with our Dart guide.
Python
Section titled “Python”Connect for Python is available in beta. You can get started with our Python guide.
Connect for Rust is pre-1.0, though the runtime already passes the full conformance suite as both client and server across all three protocols. It’s built on Tower, so it drops into Axum, hyper, and the rest of that ecosystem. Get started with our Rust guide.
What’s next?
Section titled “What’s next?”In addition to improving our current Connect implementations, we’d eventually like to bring Connect to more languages and frameworks. Our current roadmap is always pinned to the top of our GitHub discussions, and we gauge interest in new languages with GitHub polls.