ADR-00009 — gRPC for Synchronous Inter-Service Calls, REST Only at Service Edges

By Engineering Team•September 27, 2026•5 min read
  • Status: Approved / Implemented
  • Date: 2026-09-27
  • Authors: Engineering Team

Context

Every backend microservice in this platform exposes REST (or GraphQL, at shop-service) at its own admin- or client-facing edge, but every synchronous call between two backend services — shop-service → product-catalog/inventory-service/search-service, order-service → pii-service/inventory-service/payment-service/shipment-service, payment-service → order-service, shipment-service → provider-auth-service, inventory-service/tenant-service’s gRPC surfaces — uses gRPC. This pattern recurs consistently enough across the templates (@templates/go-grpc-microservice/) and the security contract (the platform’s security standards’ gRPC metadata propagation) that it deserves its own explicit rationale, rather than being re-derived (or silently contradicted) each time a new service pair is wired up. This decision is cross-cutting — it is not scoped to any single feature’s BRD/SR, unlike ADR-00005 and ADR-00008, which are scoped to product-catalog/inventory-service specifically.


Decision Drivers

  • Latency-sensitive fan-out reads: shop-service’s getShopSections/searchProducts join product-catalog and inventory-service at request time, on every storefront/product-detail request (see Architecture-00004 and shop-service) — this is a per-request, multi-call fan-out pattern where per-call overhead compounds directly into shopper-facing latency.
  • Consistent auth/multi-tenancy propagation: the platform’s security standards standardize tenant/user/role propagation as gRPC metadata (withAuthMetadata, TenantIDUnaryServerInterceptor, extract_auth_claims) across every internal call — one mechanism, reused everywhere, rather than a second REST-header equivalent invented solely for internal traffic.
  • One reusable template, not per-pair hand-rolled clients: @templates/go-grpc-microservice/ is composed file-by-file into every Go service pair that needs a gRPC client or server (see the platform’s layered architecture standard) — a single pattern that every new service pair reuses.
  • Strongly-typed cross-language contracts: protobuf-defined contracts are shared and code-generated across Go/Rust/Node service pairs, rather than each pair hand-maintaining a JSON request/response shape.

Options Evaluated

Option 1 — gRPC for every synchronous inter-service call, REST/GraphQL reserved for client-facing edges (CHOSEN)

Every backend-to-backend synchronous call uses gRPC; REST (admin wizards) and GraphQL (shop-service’s mobile-facing API, see ADR-00006) are used only where a human-operated browser or a mobile client is the caller.

  • Pros:
    • Binary protobuf serialization plus HTTP/2 multiplexing measurably reduces per-call overhead compared to JSON-over-HTTP/1.1 REST — directly benefits shop-service’s per-request fan-out join, which would otherwise pay JSON (de)serialization and connection overhead twice (once per upstream service) on every single storefront request.
    • One consistent auth-metadata propagation mechanism for every internal hop (see the platform’s security standards), instead of maintaining two parallel contracts (gRPC metadata for some pairs, custom headers for others).
    • .proto-defined contracts give compile-time-checked request/response shapes across language boundaries (Go ↔ Rust ↔ Node), catching a shape mismatch at build time rather than at runtime.
    • One reusable composition pattern (@templates/go-grpc-microservice/) for every new Go service pair, rather than each pair re-deciding its own transport and hand-rolling a client.
  • Cons & Accepted Trade-offs:
    • Requires a .proto-based contract and a codegen step per service pair, instead of being able to curl an endpoint directly during debugging — mitigated by grpcurl/similar tooling in local development.
    • A browser or mobile client cannot call gRPC directly — not a real constraint here, since no such client calls a backend service directly; ui-application goes through shop-service’s GraphQL layer and ui-admin-application goes through each service’s own REST edge, both already gRPC-backed internally where needed.

Option 2 — REST/JSON for every synchronous inter-service call

Use the same REST/JSON style internally that each service already exposes at its own edge.

  • Pros:
    • Same tooling and debugging experience as the public/admin edge — every internal call is curl-able and human-readable without additional tooling.
    • No protobuf compilation step required for a new service pair.
  • Cons (Why Rejected):
    • Higher per-call serialization/connection overhead directly costs shop-service’s per-request fan-out join pattern — the exact place where call volume is highest and latency is most shopper-visible.
    • Would still need the same tenant/user/role propagation work the platform’s security standards already solve for gRPC metadata — just redone as a second, REST-header-based contract, with no net reduction in propagation work and a second pattern to keep in sync with the first.
    • No existing precedent anywhere in this codebase for a REST-based internal service-to-service call — adopting this would mean retrofitting every already-built gRPC integration, not choosing a design up front.

Option 3 — Mixed: REST for low-traffic service pairs, gRPC for high-traffic pairs

Decide the transport case-by-case per service pair, based on that pair’s expected call volume.

  • Pros:
    • In principle lets each pair’s transport match its own traffic profile exactly.
  • Cons (Why Rejected):
    • Every new service pair would need its own protocol decision instead of one documented default, and the platform’s security and observability & tracing standards would need two parallel propagation contracts (gRPC metadata and REST headers) instead of one.
    • Contradicts the monorepo’s existing single-template convention — no service pair in this codebase actually uses REST internally today, so this option describes a pattern that was never built, not one weighed against a real alternative.

Final Decision

Option 1 is selected. It is already the pattern every real internal service pair in this platform uses — the decision documented here reflects the built system, not a proposal. gRPC’s performance profile particularly matters for shop-service’s per-request fan-out join, and reusing one auth-propagation contract and one composable template (the platform’s layered architecture and security standards) keeps every new service pair’s integration cost low and consistent.