Skip to content

Apollo gRPC

Andi Lamprecht Andi Lamprecht ·· 2 min read· Accepted
ADR-0113 · Author: Sybil Melton · Date: 2025-02-07 · Products: uncrew
Originally ADR-0084-Apollo-GRPC (v3) · Source on Confluence ↗

Apollo APIs

Context

Apollo backend is not a mere database skin. It has at least three use cases requiring server-side streaming:

  • HubOps (or anything in its place) creating a mission wishes to receive a stream of mission progress notifications so it can in turn inform its clients of the progress.
  • Pilots looking at their Apollo web frontends need to be notified whenever a new mission needs a pilot.
  • Mission Pilots (RPIC included) need to receive a stream of telemetry from the UAVs.

Many third party web services utilize REST for a lot of APIs. But REST isn’t well-suited to the server-side streaming requirements outlined above.

Decision

  • After delivering two successful PoCs:

    • grpcGateway proving that not only can gRPC be translated to REST, but also that this translation [supports streaming](Mapping streaming APIs to newline-delimited JSON streams.) to some degree.
    • grpcweb proving that gRPC can be (with some mapping and proxying) delivered to a browser.
  • Having seen a convincing demo of Postman (courtesy of Ihor Prozhoha), which pacified our concern for adequate (curl-like) tooling for gRPC.

  • Encouraged by the Ground Infrastructure choosing gRPC and translating it to REST at the Kong API Gateway (path we may or may not follow).

We are betting on gRPC to be the source of truth for API expression in all Apollo services.
If REST is ever needed, it will only be offered as translated by the grpcGateway.

Consequences

gRPC proto files define the APIs tightly, but, unlike OpenAPI they aren’t very good communicating to humans. There are no descriptions, summaries or terms of service and people notice. gRPC lack platforms like Swagger or Stoplight and any industry agreed way of communicating them. We are still deciding what to do about it.

Alternatives Considered

Both Web Sockets and raw HTTP give us streams, but no structure. We looked briefly at RSocket and the Connect Protocol, but the popularity and level of support gRPC enjoys seems to outshine those two.

Last updated on