What is the difference between Falcor and GraphQL?

Gajus picture Gajus · Aug 17, 2015 · Viewed 28.4k times · Source

GraphQL consists of a type system, query language and execution semantics, static validation, and type introspection, each outlined below. To guide you through each of these components, we've written an example designed to illustrate the various pieces of GraphQL.

- https://github.com/facebook/graphql

Falcor lets you represent all your remote data sources as a single domain model via a virtual JSON graph. You code the same way no matter where the data is, whether in memory on the client or over the network on the server.

- http://netflix.github.io/falcor/

What is the difference between Falcor and GraphQL (in the context of Relay)?

Answer

Gajus picture Gajus · Aug 24, 2015

I have viewed the Angular Air Episode 26: FalcorJS and Angular 2 where Jafar Husain answers how GraphQL compares to FalcorJS. This is the summary (paraphrasing):

  • FalcorJS and GraphQL are tackling the same problem (querying data, managing data).
  • The important distinction is that GraphQL is a query language and FalcorJS is not.
  • When you are asking FalcorJS for resources, you are very explicitly asking for finite series of values. FalcorJS does support things like ranges, e.g. genres[0..10]. But it does not support open-ended queries, e.g. genres[0..*].
  • GraphQL is set based: give me all records where true, order by this, etc. In this sense, GraphQL query language is more powerful than FalcorJS.
  • With GraphQL you have a powerful query language, but you have to interpret that query language on the server.

Jafar argues that in most applications, the types of the queries that go from client to server share the same shape. Therefore, having a specific and predictable operations like get and set exposes more opportunities to leverage cache. Furthermore, a lot of the developers are familiar with mapping the requests using a simple router in REST architecture.

The end discussion resolves around whether the power that comes with GraphQL outweighs the complexity.