Last Monday, Netflix released a developer preview of Falcor, a data-fetching library. Netflix uses Falcor to power its UIs across all platforms whether it's mobile, desktop, or TV apps.
Falcor is concerned primarily with quick and efficient data access. Falcor is designed to allow developers to represent all their backend data sources as a single JSON object. In an interview with ProgrammableWeb, Jafar Husain, Netflix’s Cross Team UI Tech Lead and the architect of Falcor, likened the process to a Web browser:
“If you think of your Web browser as a way of browsing data out in the World Wide Web, which is a big graph of interconnected resources, Falcor is sort of like a little Web browser for a JSON document. It allows you to take all your backend data sources and model them as a single JSON resource on your application server.”
Falcor takes Neflix’s 80-plus services and presents them to the developers as a single object with a single schema. Client-side tools request JSON data from the server, but instead of downloading the entire JSON object, only the small parts of the overall JSON object that are needed are requested.
Falcor handles all the network communication with the server, applying several optimization techniques to keep the communications as efficient as possible. Those individual small requests made for pieces of the JSON object are batched into one large request, cutting down on network load and increasing performance.
Falcor utilizes a fast in-memory cache, allowing quicker access to previously retrieved information, as the repeated requests will draw from the cache as opposed to returning to the server. Developers will be able to configure the max size of the cache, controlling when the cache will purge the least used values.
Netflix has been using Falcor, in various iterations, for a little over three years. The decision to create Falcor stemmed from a need to free up developers from worrying about data access. With no viable alternative in existence, Netflix poured a considerable amount of effort into creating its own platform. So why open-source that platform? We posed that question to Husain.
“What we really thrive on [at Netflix] is selling great experiences in terms of watching titles. We’re not selling software. We’re taking the good engineering that we do in-house and releasing it into the community… often doing good things helps you, and that’s what Netflix’s interest [is] in open-sourcing Falcor.”
In this release, Netflix is making available Node.js libraries to represent backend data sources as one JSON resource, and client tools that will allow efficient retrieval of data from that resource. Husain hopes that, with the release, Falcor will be able to solve other developers’ problems with data access in their UIs as it has with Netflix. What the community does with Falcor will be something to watch in the coming months.