Today we're releasing Connect, a slim framework for building browser and gRPC-compatible HTTP APIs. Connect is production-ready — focused, simple, and debuggable — and it's fully compatible with gRPC clients and servers. If you're frustrated by the complexity and instability of today's gRPC libraries, we think you'll find Connect a breath of fresh air. connect-go is available now under an Apache 2 open source license, and documentation is available on connectrpc.com. We'll release Connect for TypeScript soon, with more languages to follow.
In the seven years since its announcement, gRPC has brought much-needed consensus to Protobuf RPC. Starting from a soup of competing, mutually incompatible hobby projects, the gRPC team has rallied the community around a common protocol, introduced many developers to RPC-style APIs, and driven the popularity of Protobuf outside Google. Thanks to their tireless efforts, we can specify our APIs with Protobuf, implement them with gRPC, and be confident that most languages will have a compatible client library.
Conceptually, the gRPC protocol is HTTP with Protobuf-encoded bodies and a sprinkling of metadata. Despite that straightforward premise, the protocol and today's gRPC libraries share a maximalist design ethos that has led to extraordinary complexity. Rather than making production systems simple and stable, gRPC over-complicates development, deployment, debugging, and maintenance.
As an example, consider Google's gRPC implementation in Go:
grpc-go
is 130 thousand lines of hand-written code. It has dozens of subpackages, nearly a hundred configuration options, and bespoke name resolution and load balancing mechanisms. Just sifting through the kitchen sink of features takes hours, and the sheer quantity of code makes subtle bugs and resource leaks inevitable.net/http
, grpc-go
uses its own implementation of HTTP/2. It's incompatible with the rest of Go's HTTP ecosystem, so you can't cleanly serve gRPC requests alongside other HTTP traffic and can't use most third-party packages.curl | jq
or the Chrome network inspector — the available tools are all immature and gRPC-specific.grpc-go
doesn't follow semantic versioning; the release notes even include a special section for "Behavior Changes." At least four releases in the past year have broken backward compatibility, and prominent gRPC users (including etcd) are often unable to update for months at a time.Balancing the needs of grpc-go
's open source community and Google's internal users is a difficult and thankless task. And perhaps its breadth of features and options are required for adoption within Google. For the rest of us, the complexity and instability of grpc-go
represents an unpleasant distraction from our core business.
Connect brings simplicity back to Protobuf-powered APIs. 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.
net/http
. Connect handlers implement http.Handler
, and Connect clients wrap http.Client
. They work with any third-party router, middleware, or server.net/http
's foundation, connect-go
supports three RPC protocols: gRPC, gRPC-Web, and Connect's own protocol. Handlers support all three protocols by default, and clients can switch protocols with one config option — no other code changes necessary.curl
:# Try it out! This is a live demo!
curl \
--header "Content-Type: application/json" \
--data '{"sentence": "I feel happy."}' \
https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say
connect-go
also supports the full gRPC protocol, including streaming, headers, trailers, and error details. gRPC-compatible server reflection and health checks are available as standalone packages. Instead of cURL, we could call our Connect API with grpcurl
:# This is also a live demo!
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
grpcurl \
-d '{"sentence": "I feel happy."}' \
demo.connectrpc.com:443 \
connectrpc.eliza.v1.ElizaService/Say
If you've used the Buf CLI or Schema Registry, you've used Connect — internally, we've completely replaced grpc-go
with connect-go
. We've found Connect a joy in production: it's small, simple, and debuggable.
In Go, Connect is currently in beta: we rely on it in production, but we may make a few changes as we gather feedback from early adopters. We're planning to tag a stable v1.0
in October, soon after the Go 1.19 release. We take semantic versioning very seriously: once we release v1.0
, we'll never break your builds.
We've got big plans for the Connect ecosystem! Along with Connect in Go, we've been working on a TypeScript implementation for browsers. It shares the same design priorities: it's idiomatic TypeScript all the way down, stays close to the browser's fetch API, fits neatly into React hooks, and supports both gRPC-Web and Connect's own protocol. It also produces tiny bundles. We've already replaced grpc-web
in the Buf Schema Registry frontend, and we're planning to release connect-web
soon — stay tuned.
Eventually, we'd like to release Connect implementations for Express, Rails, Django, Laravel, and similar frameworks. You shouldn't have to choose between these productive toolkits and Protocol Buffers — they should work seamlessly together.
We'd love to hear what you think of Connect: check out the Getting Started guide, try Connect in your next Go project, poke through the demonstration project, and please file issues if something doesn't work as you expect. We're always available in the Buf Slack, and we're usually in the #grpc and #connect channels in the Gophers Slack too.