Hacker News new | ask | show | jobs
by sorenbs 3474 days ago
Hey :-) we just announced this. Happy to answer any questions. Here's the accompanying blog post https://dev-blog.apollodata.com/learn-apollo-build-graphql-a...
2 comments

Can you give a comparison between Apollo Client and Relay? And if you know about upcoming Relay 2 features, I'd like to hear about it too in the context of Apollo Client.

If you have time, I would love to hear about your (and everybody else) opinion/prediction where we're going with client data management/server communication in the future. What's your take on client databases?

Thanks!

(I work on Apollo)

It's hard to know exactly what will be included in Relay 2, so we'll have to wait to make a comparison. Apollo came after Relay 1, and so has been designed with a few key differentiators: (1) flexibility, since it's built in a modular way and has a lot of hooks into internals, (2) less opinions, because it works with any GraphQL server and doesn't require a particular type of schema, and (3) optimized for devtools, since it doesn't generate dynamic queries on the fly and is built on top of Redux. You can see the new dev tools we launched yesterday here: https://dev-blog.apollodata.com/apollo-client-developer-tool...

As for client/server communication in the future, it seems there are two main camps right now:

1. Lossy APIs - this is if you use a REST API or GraphQL to send data to the client. The server knows a lot more than the client does, and the API returns only what the client needs to know at that moment. This has the advantage that it doesn't impose any limitations on your backend schema or storage, so you can put a REST or GraphQL API on top of literally any backend.

2. Database replication, like Meteor or Realm. In this case, the client asks for objects and they are replicated to the server via some kind of push mechanism. In this case, the client has a much easier time predicting server operations and achieving consistency. On the other hand, the server has to be much smarter and this places a lot of restrictions on what kind of database you can use. For example, Meteor essentially requires MongoDB, Realm has its own database.

With Apollo we're trying to build towards the best implementation of approach (1) because our main goal is to enable decoupling between the client and server.

Sashkos answer below is pretty good.

To get a good understanding of the difference between Apollo and Relay I would suggest going through both https://learnrelay.org/ and https://www.learnapollo.com/ - should be doable in a couple hours.

After that you could take a look at the Graphcool Console https://github.com/graphcool/console It's the most complex open source app build with Relay that I'm aware of.

What is Apollo? Is it like PhoneGap? Where in the React toolchain does it fit?
Apollo is a GraphQL client - it's an npm package that helps you bind GraphQL data to your Redux store and React components. Here's the website: http://dev.apollodata.com/