One of the key concepts in modern applications and systems is the idea of the "API Economy". Instead of building monolithic applications that hide their calls and data formats internally we have the concept of exposing these endpoints in a series of API's. This allows for easy reuse and the ability to build new applications by using multiple API providers and "mashing-up" the results.

Developers have become used to using programming frameworks, such as Rails, to automate much of the boilerplate aspects of creating web apps. For instance, the Model-View-Controller (MVC) pattern expressed in a Rails app defines a clear separation of concerns and also allows a programmatic method for creating the application framework. Building web-exposed CRUD apps can not be simpler.

However, as applications have become more sophisticated and require higher scaling and performance some of the earlier frameworks have become less suitable. Built for high levels of concurrency and scaling, today we are going to install a Node.js based API server that will serve as the core for further exploration in building high performance cloud applications.

LoopBack is an open source Node.js framework built on top of Express optimized for mobile, web, and other devices. You can connect to multiple data sources, write business logic in Node.js, glue on top of your existing services and data, connect using JS, iOS & Android SDKs. Loopback uses a 'dual license' model. Users may use loopback under the terms of the MIT license, or under the StrongLoop License. Look at the GitHub repo for copies of both licenses.

According to the maintainer of LoopBack (StrongLoop):

LoopBack is a highly-extensible, open-source Node.js framework that enables you to:

  • Create dynamic end-to-end REST APIs with little or no coding.
  • Access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP, and other REST APIs.
  • Incorporate model relationships and access controls for complex APIs.
  • Use built-in push, geolocation, and file services for mobile apps.
  • Easily create client apps using Android, iOS, and JavaScript SDKs.
  • Run your application on-premises or in the cloud.

LoopBack consists of:

  • A library of Node.js modules.
  • Yeoman generators for scaffolding applications.
  • Client SDKs for iOS, Android, and web clients.

For more details, see

Visually, Loopback consists of the following modules:


In this tutorial, we will be installing and validating LoopBack on the CenturyLink Cloud.

Installing Node.js

First we need to create a server on the CenturyLink Cloud. Taking the defaults for number of CPU, memory allocation, and storage is fine. Add a public IP and allow HTTP and SSH port access. In addition, open port 3000 which we will use later to access some tools. I am using the Ubuntu 14.04 server image.

Nools 1

SSH into your new server instance as root. We are now going to set up a non-root user.

$ adduser user "loopback-user"  
# give the new user sudo privileges  
$ visudo[/preformatted-text]

Go ahead and now login as your new user <emloopback-user< em="">. In order to get the right permissions for the install of npm:</emloopback-user<>

$ sudo chown -R $USER /usr/local

OK, now we can install Node.js:

$ sudo apt-get update  
$ curl -sL | sudo bash -  
$ sudo apt-get install -y nodejs  
$ sudo apt-get install -y build-essential

Check that Node.js is installed correctly by:

$ node --version

At the time this tutorial was written, the Node.js version call returned v0.10.32

Install the StrongLoop software

To install the StrongLoop software:

$ sudo npm install -g strongloop

This will install:

Create an API

We are now going to create a simple API to show how to get started with the StrongLoop tools and LoopBack. LoopBack uses Yeoman to create applications and then provide the basic framework. From the framework you can add your application logic.

Start by running the Yeoman LoopBack generator:

$ sudo slc loopback

You will be asked for a directory to locate the application. Use LoopBackAPI. Take the default for the name of the application and hit ENTER.

At this point the application framework will be created. We are now going to create a simple in-memory data model.

$ cd LoopBackAPI  
$ sudo slc loopback:model

The generator will ask for a model name. Use Customer. Take the default data source (in-memory db) and the defaults for the pluralization of the model for the ReST API. Every model has properties and you're going to define two properties for the Customer model. For each property you'll enter a name, choose a data type, and choose whether its required.

The first property will be Name, it will be a string, and will be required. The second property will be Address, it also will be a string and required. Enter a blank property to leave the model building process.

The last step is to actually run the application. It will be attached to port 3000.

$ sudo slc run

If you point your browser at [public IP]:3000 you will see a message that looks something like this: {"started":"2014-10-20T16:20:10.628Z","uptime":854.956}. Congratulations, your API server is now active and running.

For more interesting data, point your browser at [public IP]:3000/explorer. This will bring up a detailed API explorer and you will see the Customers model and can drill into the various aspects and properties of the ReST interface.


This has been a quick introduction to the StrongBack LoopBack system. Through a series of simple steps using LoopBack you have created a Customer model, specified its properties, and then exposed it through a ReST API.