Falcor – A JavaScript library for efficient data fetching
netflix.github.io
netflix.github.io
Here are some of the reasons why:
- Falcor is not a standard or a language, its a large javascript library with conventions for manipulating data.
- GraphQL on the other hand, is a full blown query language, that is _standardized_. This means, that implementations in other languages (other than JS) will have to follow standards
- GraphQL has a very high rate of adoption, and has many libraries in other languages.
- GraphQL is backed by FB, which has a track record of releasing only things that have been tried and tested.
- Do you want a spec doc of how to write JSON Graph. It's discussed more-or-less exhaustively here: http://netflix.github.io/falcor/documentation/jsongraph.html
- That's because Netflix doesn't put any of resources into evangelizing. However it's still a valid point: if Netflix drops Falcor it's dead. I'd argue that if Facebook drops Relay/GraphQL it'd suffer a pretty sharp decline too.
- Falcor is backed by Netflix which has a track record of great open source too. Netflix was using Falcor internally for a long time before it was open sourced: if it can survive at Netflix scale it can survive at your scale too.
I'm not terribly concerned at how quickly people adopt Falcor; by all means adopt the one that suits you and your use cases. I just see a lot of bad reasons and misinformation of why not to adopt Falcor. It's a great library that would benefit a lot of users. It's a joy to consume too as a UI developer.
But what do you really mean by "standardized" in this context? Is there a known consortium of companies that provides its stamp of approval on correct implementations of GraphQL? If not, what prevents me from implementing GraphQL incorrectly in, say, OCaml?
You can run off and disobey it if you want, your implementation will just be non-standard.
This excerpt from Wikipedia might explain it better:
"The existence of a published standard does not imply that it is always useful or correct. [...] The people who use the item or service (engineers, trade unions, etc.) or specify it (building codes, government, industry, etc.) have the responsibility to consider the available standards, specify the correct one, enforce compliance, and use the item correctly. Validation of suitability is necessary."
In other words, when the GraphQL "standard" is accepted and endorsed by (for instance) Microsoft, Google, and Amazon as well, we can start listing standardization as an advantage that GraphQL has over other competing solutions.
I have a sneaking suspicion that the open sourced version of Falcor also isn't the version used internally. This is certainly true of their Prana (a sidecar used to allow a node app to talk to the rest of the Netflix stack). And the repo has had a massive slowdown and basically ground to a halt in the past year - https://github.com/Netflix/falcor/graphs/contributors.
So saying that, I'd have reservations about recommending it for other developers to use. The concepts are great, but GraphQL is more widely supported and discussed. Also the Falcor docs could use some serious work for clarity.
Though I also believe there are better ways to declaratively describe your data requirements against a graph than either Falcor or GraphQL.
> Though I also believe there are better ways to declaratively describe your data requirements against a graph than either Falcor or GraphQL.
Om.Next used Datomic Pull Syntax, it seems really powerful. Im not sure how it compares to Falcor or GraphQL.
I'm a fan of Elm, and it and Om.Next share some significant concepts I believe, so that's been guiding a lot of my thinking with regards to this stuff.
The JS Falcor Client is used at Netflix. We're not yet using the JS Falcor Router in production.
If you're writing a truly interactive system where, for example, you expect multiple devices to be active on the same account working in sync then Netflix isn't paving these paths.
If any of this sounds cool, and especially if you are in the bay area, we have ~3 immediate developer openings -- build@graphistry.com :) Come work with one of the Falcor and Rx leads, one of the original reactive web framework developers, and more :)
==
Client+cloud GPU acceleration of visual analytics -- https://giphy.com/gifs/26gsjaFVRGMwO4Yp2
Visual investigation workflow programming -- https://giphy.com/gifs/l0ExittUyY3hjugso
graphistry.com
If you're just getting into these, the major difference is the verbosity and the learning curve.
With GraphQL you need to know a lot about the schema and the types (which can be a good thing as well), with Falcor you don't and there's no easy way to code types (at least that I know of).
Whatever you choose though, I do encourage you to choose one. I have seen many APIs fail on performance because they send too much data down the wire just because one of the consumer needs it.
If the same type and structure of data is requested with only variations in which fields consumers are actually using, isn't traditional REST still a good/better fit?
The reduction in network calls is an incidental bonus - most of the time you won't see it.
Jafar Husain was the primary creator and developer of Falcor and, as far as I know, he's still at Netflix.
Recently somebody combined it with webcomponents/polymer, which is pretty awesome. Here is an example they use for realtime IoT temperature data viz, you drop in `<gun-ui-lcd parent="livingroom" prop="temperature"></gun-ui-lib>` and it automatically tells the system to ONLY load `temperature` from the `livingroom` database. More info, along with a cool animated gif showing the example off in action, is here: https://github.com/Stefdv/gun-ui-lcd#syncing .
More generally, the way it works is this:
Imagine we have some document, like
``` { name: "Alice", age: 27, pet: { name: "Fluffy", age: 4 } } ```
all we have to do is
``` Gun(serverURL).get('alice').path('pet.name').on(age => ui.show('#pet-age', age)) ```
This makes it easy to bind with React, or Angular, or VueJS, or others. The important thing to note is, like Falcor, it only loads the 1 property, not the full document. If you want to show another item, it is trivial to just add `...get('alice').path('age').on(age => ui.show('#age', age))`.
I've already made a prototype which automatically generates the loading the properties based off of a plain HTML template. Hopefully I'll have it published in the next couple months. Meaning all you have to do is add a property to your HTML, and it automatically binds realtime updates of data to that view! (No writing JS).
For the above example, we'd write React+Falcor along the lines of
//vanilla react
const myReactComponent =
props => <h1>`Hello, ${props.name} and ${props.petName}`</h1>;
//falcor live query + binding to react component
const myView = Container(
myReactComponent,
`{users['alice']: {name, pet: {name, age}}}`);
Whenever any individual field in the server model updates, we get the update, and Falcor+React takes care of batching, incremental renders, etc.I haven't really gone back to check out graphql thoroughly, although I will say since I started my falcor project the community around graphql has grown a good deal faster than the falcor community.
I haven't worked on my falcor backed app in a couple months but last I worked there were still some rough edges and small bugs with falcor and it hadn't made it to a 0.1.0 release yet and there wasn't a lot of info from netflix about when it would get there.
If I was going to start a new app right now I'd take a longer look at graphql, despite really liking the development experience of falcor because of the community / long term outlook.
Falcor is not another "new" JS framework. It has been released in 2015.
http://techblog.netflix.com/2015/08/falcor-developer-preview...
The plan was to have a new REST API without these nested entities. Yes, that means you have to make lots of little calls to the REST API, but since a payload now represented one thing only, server-side caching was vastly simplified. And, we had a Falcor router which essentially batched these calls between the client and server.
So the the client hits the Falcor router, which in turns calls the REST API over localhost, in parallel, several times. As the front-end evolved, the REST API no longer had to try to restructure its responses to cater to the new views. The incoming batch calls would just change. This in my view was the true win of the whole deal.
It worked beautifully! The fly in the ointment was that there were/are no Java or Swift clients for Falcor, so while our Angular app was humming along happily in Falcor La-La land, our mobile clients were still talking to the legacy REST endpoints. We tried standing up some clever Falcor-like batching endpoints for the mobile folks, but they understandably wanted to stick to their fat endpoints.
Meanwhile, Netflix has repeatedly stated that iOS and Android client software is not on the horizon. They've actually gotten really quiet on the Falcor front in the last year. I think the team is under-resourced at the moment, unfortunately.
I've been enamored with Falcor since it was introduced, but I couldn't fathom how the server side would work to produce the JSON Graphs without a lot of painful data reshaping of relational data. It always seemed to me that a graph database would best serve as the backing store for Falcor.
Does anyone have experience backing a Falcor-driven app with a graph database? What was that like? Would Microsoft Graph Engine pair nicely with Falcor for building a user-facing web app? I'm scared of graph databases because I fear they'd necessarily be slow or not scale horizontally compared with NoSQL.
In Graphql, the solution is usually to return `null` for restricted field. This is arguably better security than raising unauthorized exception, since attacker can't differentiate having no permission to having no data.
> You can only change your vote after 10 minutes
This in done in mutable action, which can have permission check inside.
Wasn't this the basic premise of URLs?
Some past Falcor HN submissions:
https://hn.algolia.com/?query=Falcor&sort=byDate&dateRange=a...
Kinda surprised there hasn't been much associated discussion given the number of submissions, but I know GraphQL has had a much higher profile. My personal limited exposure to Falcor has been via David Nolen when discussing influences on Om.
What's interesting is that, as a lead UI Engineer at Netflix while Falcor was being developed, much of what we were prototyping towards our new UI framework bore a lot of similarities to React. We were definitely behind them on implementation (and I don't really think we would have done as well) and I was happy when Netflix went down the React path.
Still, it's very interesting that a lot of similar ideas were coming out of both places.