Subscribe to our list to receive the latest updates on Node on Fire

Class: Firestarter


new Firestarter()

The isomorphic fire service. This service is available in both the front- and the back-end.

The service contains two methods to check at runtime whether your code is running on the client- or the server-side, respectively, Firestarter#isClient and Firestarter#isServer.

The below example illustrates the usage of the service: {
    if(fire.isServer()) {
        // The server.
    else {
        // The client.

On the back-end, the service is also responsible for orchastrating the modules and apps. You do not need to construct an instance of fire yourself.


app(id, name, settings)

Creates a new or returns an existing App.

If a options is specified, a new app will be created. If an app with the same id already exists, an exception is thrown.

If options is not specified, an existing app will be retrieved. If no app with id exists, an exception is thrown.

For example, to create a new app:

var app = require('fire')('', {type: 'angular'});


It's possible to create multiple apps which share models and other modules, but serve a different purpose. For example, you can create an admin section and the user-facing app all in the same codebase.

// Create the user-facing app
var app = require('fire')('', 'web', {type: 'angular'});

// Create an admin app
var adminApp = require('fire')('', 'admin', {type: 'angular'});

In the build and run phase you set the NODE_APP environment variable to specify which app to return.

If you retrieve an app without a name and the NODE_APP is set, that app is returned. If NODE_APP is not set, an app named default is returned.

Name Type Description
id String

The identifier of the app passed to the App constructor. This is usually the app's domain e.g.

name String

The name of the app, defaults to 'default'.

settings Dictionary

Passed directly to the app constructor. See App for more information.


The newly created or existing app.



Returns true if the code is running on the client-side.


Returns true if the code is running on the server-side.

Do you have any questions or comments on this page? Start a discussion below.

comments powered by Disqus
Subscribe to our list to receive the latest updates on Node on Fire