Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


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

Subscribe to updates I use falcor-router

Statistics on falcor-router

Number of watchers on Github 87
Number of open issues 35
Average time to close an issue 19 days
Main language JavaScript
Average time to merge a PR about 11 hours
Open pull requests 8+
Closed pull requests 9+
Last commit about 2 years ago
Repo Created over 4 years ago
Repo Last Updated over 1 year ago
Size 597 KB
Organization / Authornetflix
Page Updated
Do you use falcor-router? Leave a review!
View open issues (35)
View falcor-router activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating falcor-router for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Falcor Router Build Status

Developer Preview

This release is a developer preview. We are looking for community help to track down and fix bugs. We are also looking for help porting the Router to other platforms.

You can check out a working example server for a Netflix-like application here right now. Alternately you can go through this short tutorial:

Getting Started

Let's 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 data stores or other web services on-demand. However in this simple tutorial the Router will simply return static data for a single key.

Creating a Virtual JSON Resource with a Falcor Router

First we create a folder for our application server.

mkdir falcor-app-server && cd !$
npm init

Now we install the Falcor Router.

npm i falcor-router -S

Then install express and falcor-express.

npm i express falcor-express -S

Support for Restify is also available (including a demo): npm i restify falcor-restify -Sas is support for Hapi: npm i hapi falcor-hapi -S.

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"};

// statically host all files in 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="//"></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

More Information

For an example of a Router built for a Netflix-like application, see this repository.

For in-depth information on the Falcor Router, see the Router Guide in the Falcor Website.

For discussion please use Stack Overflow.

falcor-router open issues Ask a question     (View All Issues)
  • almost 3 years Invalidation of graph value via jsonGraphEnvelope isn't returned to client
  • almost 3 years Repo activity
  • about 3 years Exceptions in the router are not treated as the same for get/set/call
  • about 3 years [Discussion]: Strategies for modular, testable routes
  • over 3 years Returning an array as a value causes {"undefined":{"$type":"atom"}} in result
  • over 3 years Big ranges confuse the router.
  • over 3 years Need configurable timeout for request
  • over 3 years 404/Not found handler?
  • over 3 years Feature request: Provide access to shared cache in routes
  • over 3 years Feature request: Easy way to iterate every path in a pathSet
  • almost 4 years Throw error if `path` property of value object is not an array
  • almost 4 years Follow references in path Values.
  • almost 4 years Confusing behavior in path matching
  • almost 4 years update rx dependency for webpack builds
  • almost 4 years mergeTest expects objects to be equal which is the same object
  • almost 4 years Returning ref values for leaf properties
  • almost 4 years #set() should make available the 'paths' being set, or provide the pathSet object
  • almost 4 years Router should automatically wrap Arrays and non-sentinel Objects in Atom when delivered in PathValue
  • about 4 years What is the server side roadmap?
  • about 4 years Confusing wording regarding serving static files in index.js
  • about 4 years Router design, state handling and extensibility
  • about 4 years How to leverage DB join when retrieving data
  • about 4 years Meta info in route ?
  • about 4 years Bunyan logger support.
  • about 4 years combining data fetch queries - bug?
  • about 4 years Add router.onError callback
  • about 4 years Input path JSON parsing must be wrapped in try/catch.
  • about 4 years Router fails when jsong response includes arrays
  • about 4 years Router likely has bugs around empty stream handling
falcor-router open pull requests (View All Pulls)
  • Update RxJS dependency
  • Fixes pathValueMerge to merge and follow references.
  • .onRange() performance refactor
  • Update to ReactiveX/RxJS (Rx5)
  • feat(onError): Add a onError callback on the router to catch/log exce…
  • Fix error caused by undefined pathValue.value
  • DON'T MERGE YET - RxJS 5 upgrade
  • chore(prettier): run prettier on the code
falcor-router questions on Stackoverflow (View All Questions)
  • Falcor Router not resolving $ref
  • Falcor Router set method
  • Return data & reference from falcor router
  • Does Falcor Router implement route ranking?
  • Which Falcor router implementation are out there?
  • How to structure falcor router to get all available IDs?
  • Why can't I return an object in a Falcor router response?
  • Efficient way to structure falcor router for deep paths?
falcor-router list of languages used
Other projects in JavaScript