RepoAnthropicAnthropicpublished Mar 4, 2026seen 6d

anthropics/connect-rust

Rust

Open original ↗

Captured source

source ↗
published Mar 4, 2026seen 6dcaptured 14hhttp 200method plain

anthropics/connect-rust

Description: An implementation of the ConnectRPC protocol for Rust

Language: Rust

License: Apache-2.0

Stars: 417

Forks: 44

Open issues: 14

Created: 2026-03-04T18:00:38Z

Pushed: 2026-06-10T21:18:11Z

Default branch: main

Fork: no

Archived: no

README:

connectrpc

![CI](https://github.com/anthropics/connect-rust/actions/workflows/ci.yml) ![deps.rs](https://deps.rs/repo/github/anthropics/connect-rust)

A Tower-based Rust implementation of ConnectRPC, serving Connect, gRPC, and gRPC-Web clients over HTTP with binary or JSON protobuf messages.

Status: pre-1.0. The API surface is settling but may shift in 0.x. Production-quality runtime: passes the full ConnectRPC conformance suite — 3,600 server and 6,872 client tests across the three protocols.

MSRV: Rust 1.88 (declared on the workspace, verified in CI).

Documentation:

  • [User guide](docs/guide.md) - long-form coverage of installation, code generation, server/client usage, streaming, tower middleware, TLS, and errors.
  • [examples/](examples/) - runnable end-to-end examples (streaming, tower middleware, TLS, multi-service, browser/wasm, Bazel).
  • docs.rs - API reference.

Overview

connectrpc provides:

  • `connectrpc` — A Tower-based runtime library implementing the Connect protocol
  • `protoc-gen-connect-rust` — A protoc plugin that generates service traits, clients, and message types
  • `connectrpc-build`build.rs integration for generating code at build time
  • `connectrpc-health` — The standard grpc.health.v1.Health service, for grpc_health_probe / kubelet gRPC probes / service-mesh health checks
  • `connectrpc-reflection` — The standard gRPC server reflection service (grpc.reflection.v1 + v1alpha), so grpcurl, buf curl, Postman, and grpcui can discover and call your services

The runtime is built on `tower::Service`, making it framework-agnostic. It integrates with any tower-compatible HTTP framework including Axum, Hyper, and others.

Quick Start

Define your service

// greet.proto
syntax = "proto3";
package greet.v1;

service GreetService {
rpc Greet(GreetRequest) returns (GreetResponse);
}

message GreetRequest {
string name = 1;
}

message GreetResponse {
string greeting = 1;
}

Generate Rust code

Two workflows are supported. Both produce the same runtime API; pick the one that fits your build pipeline.

Option A - buf generate (recommended for checked-in code)

Runs two codegen plugins (protoc-gen-buffa for message types, protoc-gen-connect-rust for service stubs) and protoc-gen-buffa-packaging twice to assemble the mod.rs module tree for each output directory. The codegen plugins are invoked per-file; only the packaging plugin needs strategy: all.

##### Installing the plugins

protoc-gen-buffa and protoc-gen-buffa-packaging ship from the `buffa` repo - see its release page for binaries or cargo install.

For protoc-gen-connect-rust, three options:

1. Download a pre-built binary from the GitHub release. Releases ship Linux (x86_64, aarch64), macOS (x86_64, aarch64), and Windows (x86_64) binaries, each with a SHA-256 checksum, a Sigstore signature (.sig + .pem), and a GitHub-native build provenance attestation.

VERSION=v0.7.0
PLATFORM=linux-x86_64 # or darwin-aarch64, etc.
BASE=https://github.com/anthropics/connect-rust/releases/download/${VERSION}
BIN=protoc-gen-connect-rust-${VERSION}-${PLATFORM}

curl -fSL -o "${BIN}" "${BASE}/${BIN}"
curl -fSL -o "${BIN}.sig" "${BASE}/${BIN}.sig"
curl -fSL -o "${BIN}.pem" "${BASE}/${BIN}.pem"
curl -fSL -o checksums-sha256.txt "${BASE}/checksums-sha256.txt"

# Verify the checksum.
grep " ${BIN}\$" checksums-sha256.txt | sha256sum -c -

# Verify the GitHub-native attestation (no .sig/.pem download needed).
gh attestation verify "${BIN}" --repo anthropics/connect-rust

# Or verify the cosign signature directly.
cosign verify-blob \
--certificate "${BIN}.pem" \
--signature "${BIN}.sig" \
--certificate-identity "https://github.com/anthropics/connect-rust/.github/workflows/release.yml@refs/tags/${VERSION}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
"${BIN}"

install -m 0755 "${BIN}" /usr/local/bin/protoc-gen-connect-rust

2. Build from source via cargo. Pulls the latest published connectrpc-codegen crate from crates.io and installs the binary into $CARGO_HOME/bin:

cargo install --locked connectrpc-codegen

3. Buf Schema Registry remote plugin (planned). Once accepted upstream the plugin will be runnable as remote: buf.build/anthropics/connect-rust in buf.gen.yaml, with no local install step.

# buf.gen.yaml
version: v2
plugins:
- local: protoc-gen-buffa
out: src/generated/buffa
opt: [views=true, json=true]
- local: protoc-gen-buffa-packaging
out: src/generated/buffa
strategy: all
- local: protoc-gen-connect-rust
out: src/generated/connect
opt: [buffa_module=crate::proto]
- local: protoc-gen-buffa-packaging
out: src/generated/connect
strategy: all
opt: [filter=services]
// src/lib.rs
#[path = "generated/buffa/mod.rs"]
pub mod proto;
#[path = "generated/connect/mod.rs"]
pub mod connect;

buffa_module=crate::proto tells the service-stub generator where you mounted the buffa output. For a method input type greet.v1.GreetRequest it emits crate::proto::greet::v1::GreetRequest - the crate::proto root you named, then the proto package as nested modules, then the type. The second packaging invocation uses filter=services so the connect tree's mod.rs only include!s files that actually have service stubs in them. Changing the mount point requires regenerating.

> The underlying option is extern_path=.=crate::proto - same format the > Buf Schema Registry uses when generating Cargo SDKs. buffa_module=X > is shorthand for the . catch-all case. Any module an extern_path > points at must be buffa-generated code from buffa 0.7.0 or newer with > views enabled (buffa-types 0.7+ for the well-known types): the service > stubs rely on the…

Excerpt shown — open the source for the full document.

Notability

notability 4.0/10

Routine repo release, moderate stars, low HN traction