Hacker News new | ask | show | jobs
by peggyrayzis 2676 days ago
Hi from the Apollo team! This is good feedback. I agree that the GraphQL community (including us) could do a better job at educating developers about best practices for building GraphQL APIs. There's a lot that goes into standing up a GraphQL server that isn't explained on the official docs, so hopefully we can work with the GraphQL Foundation to improve that in the future.

I don't think backend services with mature REST APIs are the problem; rather, it's fetching and aggregating their data on the frontend that's cumbersome. With the complexity of modern apps, developers have to write a considerable amount of data fetching code to build out new features. They have to fetch data from multiple REST APIs, filter down that data, aggregate it, cache it, and account for loading and error states. Writing all of this state management code by hand slows developers down and leads to bugs.

Apollo aims to solve this problem by unifying around one way to query all of your app's local and remote data. This reduces state management code considerably since Apollo takes care of fetching, tracking loading and error states, and caching your data. For simple primitive values that aren't shared among multiple components, I totally agree that Apollo is overkill and would recommend seeing how far you can get with React state instead. For local data that's shared among many components, like device API results or global boolean flags that you would put in a Redux store, Apollo shines because it allows you to specify all of your data requirements declaratively in one query.

While you do have to integrate a new data graph layer into your stack to take advantage of all the state management benefits, you don't have to migrate your REST APIs. Apollo Server has a data source plugin [1] that simplifies hooking a GraphQL server up to existing REST APIs, including a cache that eliminates the need for DataLoader in most cases.

I hope this helped to clear up any misconceptions. Happy to answer any other questions you might have!

[1] https://www.apollographql.com/docs/apollo-server/features/da...