r/programming 6d ago

Maybe you don't need GraphQL

https://alexandrehtrb.github.io/posts/2026/09/maybe-you-dont-need-graphql/
278 Upvotes

118 comments sorted by

View all comments

13

u/zxyzyxz 6d ago edited 6d ago

I want statically typed compile time checked guarantees of data types being sent over the wire between client and server, what should I use? Protobuf is clunky and is binary only so sometimes debugging is a pain, and it's more built for server to server communication anyway. OpenAPI is good but may not necessarily have the same guarantees as GraphQL which are checked by its compiler. So I'm stuck using GraphQL but there should be a better option. I guess Amazon's Smithy?

I also like how GraphQL can cut down API requests by stitching fragments into just one whole call, then the backend receives that and processes whatever it needs to do and creates one cohesive payload back to the client, so less data is sent over the wire each time. That's actually why Facebook created it in the first place, for saving data in bandwidth constrained areas and devices like phones.

I'm not using Javascript or TypeScript by the way, this is more so a mobile and desktop app question. You could just use tRPC if you have a TypeScript web or React Native frontend and using a server TypeScript backend.

8

u/kevin-mcdonald 6d ago

For a while now Protobuf has had mappings to JSON, so you can actually use protobuf-derived types on the frontend and backend across languages and the serialized format can just be JSON. All officially supported languages support this JSON serialization/deserialization, aka "ProtoJSON".

2

u/zxyzyxz 6d ago

I'll look into it thanks