Ok, I need to do some explanations so people can understand the difference between Grapher and GraphQL(Apollo)
Limitations of Grapher
Grapher is limited to Meteor + MongoDB (Unless you use resolver links which can be tied to any db). If you want to expose Grapher as HTTP API (The graph requested will be in JSON format, you wonāt have to parse it with GraphQLā¦), simply create a server-side route that accepts query as JSON, transform it to JS object, call the query (grapher query request supports authorization ofcourse), return it as JSON, itās absolutely basic to do this.
Now if you plan on using MongoDB as your database, let me explain why Apollo is inferior.
Joining Hell
In the early phases of Grapher if you had something like:
users: {
posts: {
comments: {text: 1}
}
}
It would do 1 query for users. lengthOf(users) queries for posts, lengthOf(allPosts) for comments. This will kill the database, locally for a relatively small graph it wouldāve done ~2000 requests. ~3s . Donāt take in consideration the round-trip if your db is remote. I said to myself this is shit, so I began optimizing and gained 30x performance and resulted into 3 db requests. Crazy? Yes. True? Yes. And this number will exponentially increase if the depth of the graph increases.
The guys here: https://www.youtube.com/watch?v=Y7AdMIuXOgs have solved it for MySQL using JoinMonster. This is what Grapher would be for Apollo but for MongoDB.
Grapher has a built-in module for tackling relationships, even advanced ones like Meta and Many-Meta.
Manually defining relationships
With Apollo youāll have to manually do this, specify how you link collections, how to manage these links, and very important, how to secure it. Show different fields for different users, etc.
You will have to write the query for every collection you have as an entry point, and then repeat a shit load of code. This is not the case with Grapher. It automatically does that for you, it can stop certain links for certain users. Read the docs, youāll love what was done there in Exposure.
GraphQL vs JS Objects
In the beginning I admit it. Grapher was using GraphQL, believe it or not. But then I realized why not stick to JS obiects. We will have absolute flexibility in doing the request. Mixins? Just create it as a module, import it and use it. Filtering ? We do it with $filters, and it is MongoDB style filters. Options for sorting, limit, skip ? Built in as you would do it in MongoDB without having to create a query with X parameters.
Mongo style filtering directly from your browser/caller
$filters and $options for related data. Without having to implement additional and security logic. A great deal was invested in securing the graph, and it took us ~6 months to perfect it.
Reactivity
With Grapher you have reactivity switchable on and off (except for resolver links that communicate with other services) your query can be reactive or non-reactive, it will be the same API for requesting it.
Live Testing
With grapher-live package you can test your query, and you can bypass firewalls for logged in user in Meteor. This way you can actually see live who can see what and get instant feedback. GraphiQL can still do that by modifying headers, but it would be a bit hard to do with Meteor, right? I may be wrong.
Conclusion
So, bottom line is, if you want to use MongoDB and Meteor as server-side, Apollo is a small child compared to Grapher in terms of features and performance, it will lead to unsecured and unperformant code, unless you write a lot of boilerplate. If not, Apollo is the way to go for sure, thereās nothing else out there that is better (And I trully mean it!)
Sorry for ditching Apollo right now, but I said that once it gets a little bit more mature, if no-one else does it I will apply the technologies in Grapher to Apollo, unless ofcourse someone else does it first!