Eight Years of GraphQL
A critique of GraphQL's viability after 8 years raised concerns about security, performance, and maintainability. Emphasized the importance of persisted queries and understanding trade-offs before adoption.
Read original articleA recent post critiquing GraphQL sparked a discussion on its viability after 8 years of use. The author highlighted concerns like security, performance, and maintainability, suggesting that persisted queries are crucial for a robust GraphQL API. The post also delved into challenges with authorization, rate limiting, performance optimization using dataloaders, and potential coupling of business logic with the transport layer in GraphQL codebases. While the author expressed reservations about using GraphQL for public APIs due to these complexities, they acknowledged its benefits for internal APIs serving known clients. The post emphasized the importance of understanding GraphQL's nuances and trade-offs before adopting it as a technology. Overall, the discussion underscored the need for careful consideration when choosing GraphQL, recommending the use of persisted queries and caution when building public APIs with this technology.
Related
gRPC: The Bad Parts
gRPC, a powerful RPC framework, faces challenges like a steep learning curve, compatibility issues, and lack of standardized JSON mapping. Despite drawbacks, improvements like HTTP/3 support and new tools aim to enhance user experience and address shortcomings for future success.
Remix is better than GraphQL
Remix and GraphQL are compared for data loading in applications. Remix offers type-safe data fetching with loaders, while GraphQL allows selective data queries but may face challenges with authorization and performance. Remix is favored for simpler authorization and is recommended for full-stack teams, while GraphQL suits separating backend and frontend teams with expertise.
Who would torture themselves like that?
Isn't the whole point that your frontend can make the exact queries it needs and load the exact data it needs?
Namely, last I checked, client libraries for working with graphql are only good with JS. I tried working with graphql a few years ago in python and the only two client libraries absolutely sucked. Server libraries were great, but python clients sucked, badly. I ended up writing bare requests with a hardcoded heredoc for the query and endless square brackets to get the fields for the little data I needed.
Maybe the situation improved dramatically in the last three years, but I can't imagine so dramatically.
I wouldn't pick graphql as a private backend API in a million years. Well, maybe if ever single service was written in nodejs with no possibility of using other languages.
The reality is that GraphQL is a great tool for one job: building APIs that scale across thousands of engineers, billions of users, and many megawatts of machines. This is what we use GraphQL for at Meta.
To make it work well, it takes dedicated teams building infrastructure that makes the DevX great. It takes many years to build this out across various backends, clients, and internal tools. We have open sourced some of this infra — the GraphQL spec, Relay, GraphiQL, etc.
But there are many tools we built that we have not open sourced yet, largely because they’re tightly coupled to our internal ORMs, runtimes, error handling, authentication and security systems, and so on. I wish we open sourced more of our GraphQL stack, so more people could experience the awesome DevX we have internally.
At the same time, GraphQL is a tool. No tool can be used all the time for everything. Meta’s 3rd party APIs still use REST for this reason; some internal services use Thrift; etc.
It’s up to you to evaluate the tools available to build the way that makes sense for your business. Because some parts are available off the shelf, but others often need to be built in house, it is up to you to understand that cost and evaluate whether it is worth it for your use cases.
My hope is that as time goes on, more dev tools startups come in the fill the gap in tooling around client libraries, auth, security, and so on to make GraphQL a good choice at smaller scales, too. The DevX is that good when you get it right.
Just like the title of the article suggests, GraphQL is great, but ONLY in the right context.
- Good support for HTTP 1.1
- Provides typesafe contracts for queries and mutations
- Strong support for most common UI clients (JS/React Native/SwiftUI)
- Backend can be written in a language that isn't JavaScript/TypeScript
- Large developer community
Closest thing I've found is defining your schema using OpenAPI spec, and using tools to generate code from that source for the client and server, but this is a much worse DX than the process of defining GraphQL schemas.
GraphQL, but more specifically GraphQL Federation solves an organisational problem. With Federation, teams can collaborate on building an API together with a Schema Registry and Composition Checks across all Subgraphs (Services), which is a unique enabler in the market.
We've got a lot of customers in the enterprise segment and it's growing rapidly to the point where I'd say it's becoming an enterprise standard.
If you are building on Postgraphile and raising from angels, dm me.
Related
gRPC: The Bad Parts
gRPC, a powerful RPC framework, faces challenges like a steep learning curve, compatibility issues, and lack of standardized JSON mapping. Despite drawbacks, improvements like HTTP/3 support and new tools aim to enhance user experience and address shortcomings for future success.
Remix is better than GraphQL
Remix and GraphQL are compared for data loading in applications. Remix offers type-safe data fetching with loaders, while GraphQL allows selective data queries but may face challenges with authorization and performance. Remix is favored for simpler authorization and is recommended for full-stack teams, while GraphQL suits separating backend and frontend teams with expertise.