Skip to main content

Public API Choices

There are several tools for the public API, API gateway or Backend for Frontend gateway. GraphQL distinguishes itself from others for its features like tailing results, batching nested queries, performance tracing, and explicit caching.

In summary, to choose a tool for the public API, API gateway, or BFF (Backend For Frontend) gateway, I prefer GraphQL for its features like tailing results, batching nested queries, performance tracing, and explicit caching.

JSON RPCGraphQLRESTgRPC
UsecasesEtherumGithub V2, Airbnb, Facebook BFF / API GatewaySwaggerHigh performance, Google, internal endpoints
Single Endpoint✅✅❌✅
Type System✅ as weak as JSON
No uint64
✅
No uint64
✅ w/ Swagger
No uint64
✅
has uint64
Tailored Results❌✅❌❌
Batch nested queries❌✅❌❌
Versioning❌Schema ExtensionYes, w/ v1/v2 route sField Numbers in protobuf
Error HandlingStructuredStructuredHTTP Status CodeStructured
Cross-platform✅✅✅✅
Playground UI❌GraphQL BinSwagger❌
Performance tracing?Apollo plugin??
cachingNo or HTTP cache controlApollo pluginHTTP cache controlNative support not yet. but still yes w/ HTTP cache control
ProblemLack of community support and toolchainBarrister IDL42.51 kb client-side bundle sizeUnstructured with multiple endpoints. awful portability.Grpc-web dev in progress140kb JS bundle. Compatibility issues: not all places support HTTP2 and grpc dependencies

Let's stay in touch and follow me for more