I used to think GraphQL was a pretty good idea. You can change the shape of your model, do complex queries, and ultimately switch out the backends. What's not to love?
But over time I've come to realize that those features aren't all that helpful. More fixed and static responses are much easier to manage. They force the caller to do things in a performance oriented way for the backend. And, importantly, all telemetry is based on CRUD/REST style endpoints. You lose a lot of that if you just have a GraphQL endpoint. It makes it supremely hard to see how you are being called or what you can drop.
It's flexible, but it adds too much undo complexity to a system that adopts it.
Well thought out REST endpoints organically grown as usage is required or observed trumps hyper flexible endpoints created because "Who knows what the user might need". And particularly in the age of LLMs and AI where adding and deploying new endpoints can take hours rather than days. Or making/updating a client for a service is extremely fast, there's just no reason not to go down that route.
You can easily design your schema like that though and still give clients the option to throw away data at the server instead of after it goes over the wire. You don't need to add unlimited nesting at all to give so much to clients in terms of documentation etc
GraphQL is not a replacement for REST. Tbh I don’t even think its original purpose is that compelling. One thing it does shine at is representing shallow (<10 levels) of hierarchical or graph-like data with very little effort. I’ll put it in front of a couple of rest APIs stitched together from different systems to provide a cohesive graph representation of relationships that are otherwise a pain to stitch together. Your resolvers (business logic) don’t need to need to be aware of the graph nature of the representation
> You lose a lot of that if you just have a GraphQL endpoint.
Of course, GraphQL was, quite explicitly, intended to be a layer over the CRUD/REST-style endpoints. It is interesting how it tried to become something else once it left the hands of Facebook, but I guess that's par for the course when few have Facebook-type problems but like to latch onto trendy things.
> And particularly in the age of LLMs and AI where adding and deploying new endpoints can take hours rather than days.
GraphQL's main value proposition, when humans were still writing code, was providing a map of all the services in the organization to even know what was out there available to use. In a large organization it is easy to not realize that a service exists at all. LLMs can equally benefit from something like that.
Any of them relay? I find the way almost everybody does graph QL outside of Facebook just kind of sucks. It is very clearly meant to be done in a relay fashion with component scoped fragments, but all I've ever seen is gross giant page level queries that break often.
I haven't ever succumbed to graphql but this is what I see as the value -- with this approach you can have your components declare the data they need and automatically get that composed and delivered magically (from the front end perspective). It never felt worth it on any project I've worked on but if you aren't doing this part then it seems like a lot of pain for almost no benefit.
I opened the page and immediately got turned off by all the AI vibe animations to the point where I couldn't read the content and had to close the page.
The era of "AI geocities"...
---
I did try to go back and read the content (a few times), but couldn't relate with the problems. Clients will ALWAYS have dependencies on the server, no framework can erase that.
I didn't experience the GraphQL train, so can't relate to all the problems I guess.
I used to think GraphQL was a pretty good idea. You can change the shape of your model, do complex queries, and ultimately switch out the backends. What's not to love?
But over time I've come to realize that those features aren't all that helpful. More fixed and static responses are much easier to manage. They force the caller to do things in a performance oriented way for the backend. And, importantly, all telemetry is based on CRUD/REST style endpoints. You lose a lot of that if you just have a GraphQL endpoint. It makes it supremely hard to see how you are being called or what you can drop.
It's flexible, but it adds too much undo complexity to a system that adopts it.
Well thought out REST endpoints organically grown as usage is required or observed trumps hyper flexible endpoints created because "Who knows what the user might need". And particularly in the age of LLMs and AI where adding and deploying new endpoints can take hours rather than days. Or making/updating a client for a service is extremely fast, there's just no reason not to go down that route.
You can easily design your schema like that though and still give clients the option to throw away data at the server instead of after it goes over the wire. You don't need to add unlimited nesting at all to give so much to clients in terms of documentation etc
GraphQL is not a replacement for REST. Tbh I don’t even think its original purpose is that compelling. One thing it does shine at is representing shallow (<10 levels) of hierarchical or graph-like data with very little effort. I’ll put it in front of a couple of rest APIs stitched together from different systems to provide a cohesive graph representation of relationships that are otherwise a pain to stitch together. Your resolvers (business logic) don’t need to need to be aware of the graph nature of the representation
> You lose a lot of that if you just have a GraphQL endpoint.
Of course, GraphQL was, quite explicitly, intended to be a layer over the CRUD/REST-style endpoints. It is interesting how it tried to become something else once it left the hands of Facebook, but I guess that's par for the course when few have Facebook-type problems but like to latch onto trendy things.
> And particularly in the age of LLMs and AI where adding and deploying new endpoints can take hours rather than days.
GraphQL's main value proposition, when humans were still writing code, was providing a map of all the services in the organization to even know what was out there available to use. In a large organization it is easy to not realize that a service exists at all. LLMs can equally benefit from something like that.
How is that not covered by rest api docs though?
Solving own problems, that most other stacks don't have
I have worked in tens of React projects and there is not one that GraphQL made better. It is agonizing to see it still "surviving".
Any of them relay? I find the way almost everybody does graph QL outside of Facebook just kind of sucks. It is very clearly meant to be done in a relay fashion with component scoped fragments, but all I've ever seen is gross giant page level queries that break often.
I haven't ever succumbed to graphql but this is what I see as the value -- with this approach you can have your components declare the data they need and automatically get that composed and delivered magically (from the front end perspective). It never felt worth it on any project I've worked on but if you aren't doing this part then it seems like a lot of pain for almost no benefit.
I opened the page and immediately got turned off by all the AI vibe animations to the point where I couldn't read the content and had to close the page.
The era of "AI geocities"...
---
I did try to go back and read the content (a few times), but couldn't relate with the problems. Clients will ALWAYS have dependencies on the server, no framework can erase that.
I didn't experience the GraphQL train, so can't relate to all the problems I guess.