Getting started with IBM Bluemix and Node.js

Share this post:

If you’re like me when using a new system, it’s nice to have the simplest conceivable example to try out first and then play around a bit to make sure you’re in the driver’s seat. For the brand new IBM Bluemix user, here’s my attempt with no frills and no philosophy—just a very small amount of code and how-to. There are some wonderful directions on the fabulous Bluemix web UI available on the Bluemix website.

What you’ll be doing

You’re going to sign up to get an IBM ID, sign up for Bluemix, then run through a few simple commands to get your first piece of code up and running. This little run-through will use only the tiniest corner of the power of Bluemix—but every journey starts with a first step.

Micro-primer on Bluemix

Bluemix provides a platform as a service (PaaS) for several different runtimes, specifically:

• Node.js – supporting server-side JavaScript
• Liberty for Java – a highly composable, fast and light profile of IBM WebSphere Application Server designed for the cloud
• Ruby on Rails and Ruby Sinatra – focused on quickly creating web-applications in Ruby with minimal effort

This means that you can deploy an application of any of these types to Bluemix, without having to worry about server setup or configuration.

Let’s go

If you don’t have one already, sign up to get an IBM ID.

Step 1: Sign up for IBM Bluemix

This gets you an account on the brand new IBM Cloud Foundry-based platform as a service (PaaS) cloud. Sign up for the open beta.

It’s well worth exploring the website, the user interface and examples. The rest of this article takes another perspective—the command-line approach!

Step 2: Install the Cloud Foundry CLI, the official command line client for Cloud Foundry.

This is the command that you’ll use to get your code deployed and running on Bluemix.

Install the Cloud Foundry CLI for your system. Scroll down through the readme file to the Installers section for your platform

Step 3: Download the files you’re going to deploy

The kit includes the following parts:

• manifest.yml, which tells Bluemix that it’s being given a node.js application
• server.js, which contains JavaScript code that implements a tiny node.js-based web server
• package.json, which defines to the node.js runtime the dependencies that server.js has

All of these are available as open source on JazzHub, where you will also find:

•, a very thorough description of server.js, in markdown format

Step 4: A tiny edit; edit manifest.yml to give your host a unique name.

This is important!  Your little server will have a URL that starts with this name.

Step 5: Tell Cloud Foundry to use the Bluemix (web) application programming interface (API)

This command tells the cf command-line that it should direct its interactions at Bluemix. Since this is a web API, all you need to do is specify a URL.

$ cf api
Setting api endpint to OK

You only need to do this once. All subsequent commands will interact with the Bluemix web API.

Step 6: Log in to Bluemix

cf login

Enter the IBM ID and password that you set up.

Step 7: Push your application to Bluemix!

Open up a command line for your operating system and navigate to the place where you saved the files from JazzHub and simply type:

cf push

Lots of magic happens now:

• Using the information in the manifest.yml file, Bluemix knows how to create a runtime for the application
• Using information in package.json, it will realize that this application needs express.js in order to run, and it will run the NodePackage Manager to get that dependency installed (you’ll see lots of information scroll up your screen as express.js and its dependencies get installed)
• Finally, it starts server.js

A few other useful commands to list your apps and to start or stop each one are:

cf apps Lists all of your applications
cf start app_name Starts app_name
cf stop app_name Stops app_name

Step 8. “Bonjour, tout le monde”

Go to your favorite browser and enter the URL:


Alternatively, you can try mine at

Let’s look at each file in turn:



manifest.yml is used by Bluemix to determine what to do with the other files it is given. You can think of it as a way of bundling up a pile of cf command-line options into a file.

# the URL for the application will be .
# in this example, that's
- host: change_this_to_something_unique
# the name of the application that you will see if you type 'cf apps'
name: BonjourLeMondeApp
# the files to 'push' are in the current directory
path: .
# bluemix runs this command to initiate the application
command: node server.js
# tell bluemix to create 1 server instance
instances: 1


This file is required by the node.js runtime. Apart from naming the package, it defines the dependencies. In this case, the only dependency is on express.js (, a minimal and flexible node.js web application framework

"name": "BonjourLeMonde",
"description": "Very simple node.js server using Express",
"version": "0.0.1",
"dependencies": {
"express": "3.x"


This file is a very simple node.js application written in JavaScript. Once it’s deployed to Bluemix, if you type
into your browser, it responds with “Hello world, from England.” While typing
gets you the response “Bonjour tout le monde, de la France.”

The only point I will note in this article is that these few lines of code (hopefully self evident) are there to provide the response in English.

// specify what to do when http GET is received on http:///english
app.get('/english', function(req,res){
res.send("Hello world, from England.");

Feel free to experiment by adding your own language support!

If you don’t know node.js

There is a very thorough analysis of every line of server.js in the overview on JazzHub.
It attempts to take you from zero knowledge of node.js to a thorough understanding of server.js.

In this post, I took you thorough a simple example to get some experience with Bluemix. If you would like to continue this discussion, you can connect with me on Twitter at @robphippen.

Add Comment
No Comments

Leave a Reply

Your email address will not be published.Required fields are marked *

More Archive Stories

It’s all about the business: Winning in the cloud with IBM Cloud Service Provider platform

In a previous blog post, “The new “C” in CSP: from communications to cloud service provider”, I discussed the analysts’ estimates on public cloud market opportunity and expected growth. I explained why communications service providers (CSPs) are uniquely positioned to take advantage of this opportunity. I also summarized the actions that CSPs must take to […]

Continue reading

June #cloudchat: The Open Cloud Movement

Open technology is the foundation for a robust cloud. Without it, says Angel Diaz, Vice President, IBM Open Technology and Cloud Performance, “you are building a dead end cloud, whether you look at the infrastructure, the platform or how you interact.” But how can we ensure that open cloud technology stays firmly entrenched on the […]

Continue reading

Can cloud bridge the gap between lines of business and IT?

Over the course of our lengthy careers in information technology (IT) and sales, it has taken many years for us to understand a simple but pervasive fact: in many companies, people from the lines of business (LOB) and people from the IT department don’t really understand each other. In some cases, they behave as if they belonged to different companies.

Continue reading