Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 23, 2026·3 min de lecture

ConnectRPC — Simple Browser-Compatible RPC over HTTP

ConnectRPC is a slim RPC framework that generates type-safe clients and servers from Protobuf definitions, speaking gRPC, gRPC-Web, and its own HTTP-friendly Connect protocol through a single codebase.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Needs Confirmation · 64/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
ConnectRPC Overview
Commande CLI universelle
npx tokrepo install 2d7ac20c-5661-11f1-9bc6-00163e2b0d79

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/http in 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-go for Go code generation
  • Use @connectrpc/connect and @connectrpc/connect-web for TypeScript clients
  • Register handlers on any http.ServeMux or router—no proprietary server needed
  • Configure TLS and HTTP/2 via standard Go net/http or 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 --json works 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 uses net/http and 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.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires