Connect · gRPC Services

Deploy independent services in any language and connect them to your graph

gRPC Services run anywhere, scale independently, and implement in any gRPC language. The Router handles GraphQL translation.

Python, Java, Go, C#, Node.js, Rust, and more.

Available onFreeProEnterprise

The problem

Distributed teams need distributed services

GraphQL Federation should not dictate how backend services scale, deploy, or what language they use. When it does, teams resist adoption.

All services must use the same GraphQL framework

Traditional subgraphs require teams to adopt a compatible GraphQL library. For Java, Python, or Rust teams, the available options may be limited or poor quality.

Services cannot scale independently

When services couple to the gateway deployment model, you cannot scale a high-traffic catalog service without also scaling everything else.

Different teams need different release cycles

Shared infrastructure means one team's deployment can block another. Teams lose ownership over their services.

Our solution

Independent services, any language

gRPC Services are independent microservices that communicate with the Cosmo Router over the network. Each service deploys, scales, and releases on its own schedule. Teams implement in any gRPC language.

How gRPC Services integrate

  1. Write a GraphQL subgraph schema. Add `@connect__fieldResolver` directives for custom field resolution logic.

  2. Run `wgc grpc-service generate` to produce Protocol Buffer definitions and type-safe service stubs.

  3. Implement the gRPC service in any language: Python, Java, Go, C#, Node.js, Rust, and others.

  4. Deploy the service anywhere with network connectivity to the Router: same cluster, different region, or a different cloud.

  5. The Router discovers the service, connects over the network, and translates GraphQL operations to gRPC calls.

  6. Field resolver requests batch automatically via DataLoader. No N+1 problems.

Any language. Any infrastructure. The Router connects them.

gRPC Services

Before & After

Before CosmoWith Cosmo
All services must use GraphQL frameworksServices implement gRPC contracts in any language
Services coupled to gateway deploymentIndependent deployment and release cycles
Single scaling model for all servicesEach service scales based on its own requirements
Centralized team must manage integrationsTeams own their services end-to-end

Field resolvers

Custom resolution with automatic batching

Define field resolvers using the @connect__fieldResolver directive with context parameters. The generated protobuf includes RPC methods for each field resolver. The Router automatically batches requests across entities via DataLoader.

Broad type support: scalars, enums, interfaces, recursive types, nested objects, and complex lists. Schema linting validates against gRPC compatibility requirements.

How gRPC Services work in Cosmo Router

01
Schema-first. Proto generated.

Define

Write a GraphQL subgraph schema. Add `@connect__fieldResolver` directives for custom field resolution. The schema drives everything downstream.

02
CLI generates stubs.

Generate

Run `wgc grpc-service generate` to produce Protocol Buffer definitions and type-safe service stubs. The CLI validates the schema against gRPC compatibility requirements.

03
Any gRPC language.

Implement

Build the gRPC service in Python, Java, Go, C#, Node.js, Rust, or any other gRPC language. Deploy independently using any deployment platform.

04
DataLoader batching, no N+1.

Connect

The Router connects over the network. Field resolver requests batch via DataLoader automatically. Entity lookups support single, multiple, and compound keys.

Capabilities

What gRPC Services provide

Language freedom, independent deployment, and field resolvers with automatic batching.

Any gRPC language

Python, Java, Go, C#, Node.js, Rust, and any other language with a gRPC runtime. Choose the right language for each service.

Independent scaling

Scale each service based on its load patterns. A high-traffic service scales without affecting the Router or other services.

Field resolvers with DataLoader batching

Implement custom resolution logic via the `@connect__fieldResolver` directive. The Router batches requests across entities automatically.

Entity lookups

Full support for single keys, multiple keys, and compound keys in GraphQL Federation entity resolution.

Broad type support

Scalars, enums, interfaces, recursive types, nested objects, and complex lists are supported. Nullable list items and custom scalar conversion are not.

Schema linting

The CLI validates your schema against gRPC compatibility requirements before you build, with clear error and warning reporting.

Deploy your first gRPC Service

Define a schema, generate protobuf stubs, implement in any gRPC language.

FAQ

gRPC Services questions

Deep dive in the gRPC Services documentation.