Introduction
ConnectRPC simplifies RPC by building on standard HTTP. It generates type-safe clients and handlers from Protobuf schemas, and each server simultaneously speaks three protocols—Connect (simple HTTP), gRPC, and gRPC-Web—so browsers, mobile apps, and backend services all hit the same endpoint.
What ConnectRPC Does
- Generates type-safe client and server code from Protobuf service definitions
- Serves the Connect, gRPC, and gRPC-Web protocols on a single port and handler
- Works with
net/httpin Go, requiring no special HTTP server or mux - Supports unary, server-streaming, client-streaming, and bidirectional streaming RPCs
- Provides interceptors for authentication, logging, and observability middleware
Architecture Overview
ConnectRPC generates handler and client code via protoc-gen-connect-go (Go), @connectrpc/connect (TypeScript), or plugins for other languages. Handlers register as standard HTTP handlers, detecting the protocol from each request's Content-Type header. The Connect protocol uses simple HTTP POST with JSON or Protobuf bodies—curl-friendly without special tooling. gRPC and gRPC-Web requests on the same endpoint are handled transparently.
Installation & Configuration
- Install the Buf CLI and
protoc-gen-connect-gofor Go code generation - Use
@connectrpc/connectand@connectrpc/connect-webfor TypeScript clients - Register handlers on any
http.ServeMuxor router—no proprietary server needed - Configure TLS and HTTP/2 via standard Go
net/httpor your preferred reverse proxy - Add interceptors in the handler or client constructor for cross-cutting concerns
Key Features
- Three protocols (Connect, gRPC, gRPC-Web) from a single handler implementation
- Browser-native: the Connect protocol works with
fetch()without a proxy - curl-friendly:
curl -X POST --jsonworks against Connect endpoints - Standard HTTP middleware compatibility (no gRPC-specific interceptor chains)
- Streaming support across all three protocols including bidirectional
Comparison with Similar Tools
- gRPC-Go — requires
grpc.NewServer()and HTTP/2; ConnectRPC usesnet/httpand adds browser support - Twirp — Protobuf-based RPC by Twitch; unary only, no streaming or gRPC compatibility
- gRPC-Web — requires an Envoy or grpc-web proxy for browsers; ConnectRPC serves browsers directly
- tRPC — TypeScript-native RPC without Protobuf; ConnectRPC provides cross-language schemas
- REST/OpenAPI — manual endpoint design; ConnectRPC auto-generates clients and servers from a schema
FAQ
Q: Can I call ConnectRPC services from a browser?
A: Yes. The Connect protocol uses standard HTTP and works natively with fetch(). The TypeScript client library handles serialization.
Q: Do I need Envoy or a special proxy? A: No. ConnectRPC handlers serve gRPC, gRPC-Web, and Connect directly on standard HTTP, eliminating the need for a translation proxy.
Q: Which languages does ConnectRPC support? A: Go, TypeScript/JavaScript, Swift, and Kotlin have official client and server libraries. The Connect protocol is simple enough for any HTTP client.
Q: Is ConnectRPC compatible with existing gRPC services? A: Yes. ConnectRPC clients can call standard gRPC servers, and ConnectRPC servers accept standard gRPC clients.