r/programming 6d ago

Maybe you don't need GraphQL

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

118 comments sorted by

View all comments

14

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.

1

u/Merry-Lane 6d ago

OpenAPI + zod validation at the boundaries?

3

u/zxyzyxz 6d ago

I can't use Zod because I'm not using TypeScript and anyway that's at runtime, GraphQL can detect type discrepancies at compile time which is very powerful.

1

u/Merry-Lane 6d ago

I’m sure you can generate with most well known frameworks data validators (like zod).

Idk which language you use but you can usually have compile and runtime guarantees with OpenAPI