Live data from Hacker News

The GraphQL stack: How everything fits together

dev-blog.apollodata.com

81–90 of 116 posts

Re: The GraphQL stack: How everything fits together

#81

I'd love to see some examples of a proper GraphQL gateway that consumes the cache control

We've got one here you can try out, and I hope people build more! https://www.apollographql.com/engine/ (Disclaimer: I work on Engine)

Oh I know about engine. I'm talking an open source one

Re: The GraphQL stack: How everything fits together

#82

Has anybody found a way to combine GraphQL and REST in a common API? I've searched but so far found no idiomatic ways to accomplish that. The reason I need REST in addition to GraphQL is that there are sometimes oddball cases where only GraphQL is a poor fit or where compatibility with older clients that I can't modify has to be ensured. Also, is there a good way to do file upload of big files with GraphQL nowadays?

We're developing a REST framework, which lets the client to shape response on a predetermined and constrained set of endpoints on the server. The client can include/exclude parts of the data (attributes and relationships), set filters and request aggregation. You may take a look: http://linkrest.io

So you're basically cloning OData, aren't you?

Re: The GraphQL stack: How everything fits together

#84
post #38

Earlier quoted context omitted.

Can't upvote this enough. From what I've read it sounds like GraphQL solves a problem at Facebook where they have so many people working on related data at the same time that they started seeing duplicate API endpoints, and duplicate requests for the same data from different parts of the team. GraphQL provides a chokepoint to prevent that from occurring. Makes total sense at that scale. Why startups are adopting this…

A huge selling point for me is that the client explicitly enumerating all fields they're interested in allows targeted deprecation warnings and finely grained usage statistics.

Another thing that sounds worthy when working on gigantic teams and less so when at a startup / small company.

Re: The GraphQL stack: How everything fits together

#85
post #38

GraphQL is above all, just an optimization. It optimizes the amount of bytes sent over the network. I'm very happy with REST APIs (maturity level 2/3) and see no reason to change as we've never had performance issues. Most companies are not Facebook with 1 billion customers. The fact that clients can compose their own queries brings nothing new, as you still have to allow these capabilities on your server, just like…

Can't upvote this enough. From what I've read it sounds like GraphQL solves a problem at Facebook where they have so many people working on related data at the same time that they started seeing duplicate API endpoints, and duplicate requests for the same data from different parts of the team. GraphQL provides a chokepoint to prevent that from occurring. Makes total sense at that scale. Why startups are adopting this…

There's some truth to what you're saying, but I think you're also selling GraphQL a bit short. Don't forget that Netflix also independently developed a very similar technology (Falcor) because of a need somewhat different than what you describe.

In their case, there was a need to have a single server-side be able to support literally hundreds of different client-side implementations that often had vastly different capabilities. An implementation for an embedded "smart" BluRay player is going to be very different from the first-party implementation that someone pulls up when they visit the .com in Chrome. Not only will it have different memory/CPU requirements, the BluRay player's client probably won't even be written by Netflix employees.

What GraphQL solves, to me, is any situation where the server-side implementation cannot make assumptions about the client-side. Whether that's because there are multiple clients or the client team is not coordinating their delivery with the server team, it's yet another example of the observation that software architecture eventually mirrors the way teams are organized. And I agree that many smaller businesses are probably jumping on the GraphQL bandwagon prematurely/unnecessarily. But I think the problem it solves is broader than you acknowledge and there are far more instances where the organization of the humans writing code favors an approach that decouples the server and client in the way that GraphQL and Falcor accomplishes.

Re: The GraphQL stack: How everything fits together

#86
The thing that bothers me about GraphQL is that it adds multiple layers that I have to debug if something goes wrong.

I have an app that displays a hello world from the server, and it's not displaying, where is the problem? Is it in my UI code? is it in Relay? is it in the server side part of GraphQL? is it in my actual API that returns hello world?

If I'm using a good MVC framework on a the backend, I most likely model my schema already in some way, having to duplicate that same information for GraphQL feels wrong.

GraphQL fixes the over-fetching problem, however it requires me to implement a server side component for this, that makes me think if it would be less effort to just refine the server side endpoints and not having to support an extra service.

Re: The GraphQL stack: How everything fits together

#87

Earlier quoted context omitted.

(Author of the post here) > GraphQL is above all, just an optimization. It optimizes the amount of bytes sent over the network. This was a common thought when GraphQL was first announced, but working with organizations that are adopting it we've found just the opposite: It's actually the tooling and development velocity benefits that people get the most value of. It's kind of like if you could design your API to be s…

Thanks for your reply. I've not ditched graphQL forever, but there's a lot of buy-in involved for what it could give me right now. The tech is quite intrusive on your web server. I didn't know people using redux also cached responses forever, that seems beyond naive to me :)

Note that "forever" here means "for as long as this specific browser tab is open", both for GraphQL and for Redux.

Re: The GraphQL stack: How everything fits together

#88
post #84

Earlier quoted context omitted.

A huge selling point for me is that the client explicitly enumerating all fields they're interested in allows targeted deprecation warnings and finely grained usage statistics.

Another thing that sounds worthy when working on gigantic teams and less so when at a startup / small company.

Chose the right tech early and you’ll have less growth pain.

I can’t tell you the number of startups I’ve seen that spend time thrashing on their REST APIs who would be better off using GraphQL as the consumable interface.

Would have made many companies supplication development go WAY smoother

Re: The GraphQL stack: How everything fits together

#89
post #84

Earlier quoted context omitted.

Another thing that sounds worthy when working on gigantic teams and less so when at a startup / small company.

Chose the right tech early and you’ll have less growth pain. I can’t tell you the number of startups I’ve seen that spend time thrashing on their REST APIs who would be better off using GraphQL as the consumable interface. Would have made many companies supplication development go WAY smoother

You're saying "graphQL is always better than REST for new/small companies"; that's simply not true. It's a tradeoff. Same with (g)RPC.

Just like you wouldn't buy and install 20 powerful servers to run kafka on day 1 just in case your startup meet huge success in 2 years.

Re: The GraphQL stack: How everything fits together

#90
post #75
post #73

Earlier quoted context omitted.

But what comes back? Lets say I request a user, his name, email and all their friends. But I don't have access to the friends. Now do I get nothing back and the error that my request would include data I have no access to? Or would I get name and email, but the list of friends would be empty? would I get an additional warning somewhere so I know it's an permission problem and the user doesn't have no friends? Would I…

That's entirely up to you and how you choose to implement your fields' resolutions.

Are there any best practices?
Post reply on HN