First, install gcloud with npm and require it into your project:

$ npm install --save gcloud
var gcloud = require('gcloud');

If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to gcloud— we figure that out for you.

However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.

// Compute Engine var gcloud = require('gcloud'); // Elsewhere var gcloud = require('gcloud')({ projectId: 'project-id', keyFilename: '/path/to/keyfile.json' });

The full set of options which can be passed to gcloud and sub-modules are outlined here.