falcor 0,6,5,0,8,3,5,0 eslint travis-ci gulp npm webpack

A JavaScript library for efficient data fetching

Falcor Build Status Coverage Status bitHound Score

Developer Preview

1.x does not mean we are out of developer preview mode. Simply means we are breaking the contract and we would like to respect ^ within peoples NPM dependencies. 1.x does contain breaking changes that can be reviewed here

This release is a developer preview. We are looking for community help to track down and fix bugs. We are also looking for help integrating with existing MVC frameworks, as well as ports to other platforms.

  • master currently reflects work in progress, and contains backward incompatible changes which will become the next major version bump.
  • 0.x reflects the currently published npm version. Bug fixes specific to 0.x can be submitted against this branch.

Important Note for Webpack Users

If you’re including falcor in your app, via npm and require('falcor'), and you’re building a browser bundle for your app with Webpack, you’ll need to add an alias entry for the ‘rx’ module in your webpack config, to avoid this RxJS bug: ‘https://github.com/Reactive-Extensions/RxJS/issues/832’. You may already have such an entry, if you’re using RxJS already. An example is below:

In webpack.config.js:

module.exports = {
  resolve: {
    alias: {
      // Workaround https://github.com/Reactive-Extensions/RxJS/issues/832, until it's fixed
      'rx$': <path to rx/dist/rx.js file >

Getting Started

You can check out a working example server for a Netflix-like application here right now. Alternately you can go through this barebones tutorial in which we use the Falcor Router to create a Virtual JSON resource. In this tutorial we will use Falcor’s express middleware to serve the Virtual JSON resource on an application server at the URL /model.json. We will also host a static web page on the same server which retrieves data from the Virtual JSON resource.

Creating a Virtual JSON Resource

In this example we will use the falcor Router to build a Virtual JSON resource on an app server and host it at /model.json. The JSON resource will contain the following contents:

  "greeting": "Hello World"

Normally Routers retrieve the data for their Virtual JSON resource from backend datastores or other web services on-demand. However in this simple tutorial the Router will simply return static data for a single key.

First we create a folder for our application server.

mkdir falcor-app-server
cd falcor-app-server
npm init

Now we install the falcor Router.

npm install falcor-router --save

Then install express and falcor-express. Support for restify is also available, as is support for hapi via a third-party implementation.

npm install express --save
npm install falcor-express --save

Now we create an index.js file with the following contents:

// index.js
var falcorExpress = require('falcor-express');
var Router = require('falcor-router');

var express = require('express');
var app = express();

app.use('/model.json', falcorExpress.dataSourceRoute(function (req, res) {
  // create a Virtual JSON resource with single key ("greeting")
  return new Router([
      // match a request for the key "greeting"
      route: "greeting",
      // respond with a PathValue with the value of "Hello World."
      get: function() {
        return {path:["greeting"], value: "Hello World"};

// serve static files from current directory
app.use(express.static(__dirname + '/'));

var server = app.listen(3000);

Now we run the server, which will listen on port 3000 for requests for /model.json.

node index.js

Retrieving Data from the Virtual JSON resource

Now that we’ve built a simple virtual JSON document with a single read-only key “greeting”, we will create a test web page and retrieve this key from the server.

Now create an index.html file with the following contents:

<!-- index.html -->
    <!-- Do _not_  rely on this URL in production. Use only during development.  -->
    <script src="https://netflix.github.io/falcor/build/falcor.browser.js"></script>
    <!-- For production use. -->
    <!-- <script src="https://cdn.jsdelivr.net/falcor/{VERSION}/falcor.browser.min.js"></script> -->
      var model = new falcor.Model({source: new falcor.HttpDataSource('/model.json') });

      // retrieve the "greeting" key from the root of the Virtual JSON resource
        then(function(response) {

Now visit http://localhost:3000/index.html and you should see the message retrieved from the server:

Hello World

Additional Resources

For detailed high-level documentation explaining the Model, the Router, and JSON Graph check out the Falcor website.

For API documentation, go here

For a working example of a Router, check out the falcor-router-demo.

For questions and discussion, use Stack Overflow.

Related Repositories



A JavaScript library for efficient data fetching ...



A simple, full-stack JavaScript single page app featuring React, Webpack, and Falcor ...



Connect your redux front-end to your falcor back-end ...



Demonstration Falcor end point for a Netflix-style Application using express ...



A Falcor JavaScript DataSource which creates a Virtual JSON Graph document on your app server. ...

Top Contributors

michaelbpaulson trxcllnt sdesai jhusain falcor-build lrowe nicolasartman msweeney dzannotti jontewks gdi2290 ktrott JMBattista megawac bcardi jayphelps brenelz aspyker Swatinem radarhere c0 carlosperez carsonmcdonald clarle diessica jimaek greim HenriqueLimas jshen212 jhamlet


package version
asap 2.0.3
falcor-json-graph 1.1.7
falcor-path-syntax 0.2.4
falcor-path-utils 0.5.1
rx 2.5.3
symbol-observable ^1.0.4
dev benchmark ^1.0.0
body-parser ^1.13.3
browserify ^10.2.0
bundle-collapser ^1.2.1
chai ^1.9.1
coveralls ^2.11.2
csv-parse ^0.1.3
del ^1.2.1
express ^4.13.3
falcor-express ^0.1.2
falcor-http-datasource 0.1.3
falcor-router ^0.4.0
falcor-router-demo ^1.0.3
grunt ^0.4.5
gulp ^3.9.0
gulp-concat ^2.6.0
gulp-eslint ^2.0.0
gulp-istanbul ^0.3.1
gulp-license ^1.0.0
gulp-mocha ^1.1.0
gulp-rename ^1.2.0
gulp-shell ^0.4.1
gulp-uglify ^1.2.0
jsdoc ^3.3.0-beta3
karma ^0.13.9
karma-benchmark ^0.4.0
karma-chrome-launcher ^0.2.0
karma-firefox-launcher ^0.1.6
karma-junit-reporter ^0.3.4
karma-safari-launcher ^0.1.1
lodash ^2.4.1
minimist ^1.1.0
mkdirp ^0.5.1
promise 7.0.4
rxjs ^5.0.0-rc.1
sinon ^1.15.4
through2 ^0.6.1
underscore ^1.8.3
vinyl-source-stream ^1.1.0


-   v0.1.17 zip tar
-   v0.1.15 zip tar
-   v0.1.14 zip tar
-   v0.1.13 zip tar
-   v0.1.12 zip tar
-   v0.1.11 zip tar
-   v0.1.9 zip tar
-   v0.1.8 zip tar
-   v0.1.7 zip tar
-   v0.1.5 zip tar
-   v0.1.2 zip tar
-   v0.1.0 zip tar
-   v0.0.22 zip tar
-   v0.0.21 zip tar
-   v0.0.17 zip tar
-   v0.0.16 zip tar
-   v0.0.15 zip tar
-   v0.0.14 zip tar
-   v0.0.13 zip tar
-   v0.0.12 zip tar
-   v0.0.11 zip tar
-   v0.0.10 zip tar
-   v0.0.9 zip tar
-   v0.0.8 zip tar
-   v0.0.7 zip tar
-   v0.0.6 zip tar
-   v0.0.5 zip tar
-   v0.0.4 zip tar