Getting Started Guide

Here is everything you'll need to get your first BrightWork API deployed and ready to go. This walkthrough will guide you through the basics:

Signing Up for BrightWork

Signing up for Brightwork is quick and simple. To get started, go to the BrightWork sign-up page. Complete the sign-up process. Remember your username and password. You will need them to login to the BrightWork CLI. After signing up, you should receive an authentication email like this:

Auth Image

After you click the 'Activate' link you're ready to install the BrightWork CLI.

Installing the BrightWork CLI

First create a directory where you'd like to build a BrightWork App. Then, navigate to that directory in the terminal.

First, Make sure you have NodeJS installed. The minimum required version is node 3.0 you can check this with the following command:

node -v

If Node is not installed, you can install it using Homebrew by running:

brew install node

Click here if you need to install Homebrew

Node is bundled with npm so now you can install the BrightWork CLI by running:

npm install -g bw-cli

Now, the BrightWork CLI is installed and you are able see a list of available commands by running:

bw help

Help Image

Pushing Your First App

Before you can push your first app, you'll need to generate a manifest where you'll be defining the schema of your data models and their relationships. To do this, simply run:

bw init

This will create a manifest.yml file in your project directory. Open manifest file in your text editor and make any changes necessary. Remember to include a name for your app. In the example below, we've called it 'photo-app-demo'. For this example, we'll be building an app that has albums and photos.

name: photo-demo-app
    name: string
      collection: 'photo'
      via: 'album'
    caption: string
    url: string
      model: 'album'

This setup will create albums with with a one to many relationship with photos, and photos that have one album. When done editing your maifest.yml, save it. Next you will need to login with the username and password created during sign-up. Do this by running:

bw login

Login Image

Once you've logged in you can now deploy your app by running:

bw push

Push Image

After pushing the changes, your API will be deployed and you'll have access to your API key by running

bw list

List Image

This key is what you'll need to include in the header of all your HTTP requests going forward. Here is an example request to get create the album "Family Vacation" in the photo app:

curl -X POST -H "apikey: API_KEY_GOES_HERE" -H "Content-Type: application/json" -d '{"name": "Family Vacation" }' ""

The API is now setup, deployed and ready to go for RESTful requests related to the album and photo models. Check out the BrightWork documentation for a complete list of RESTful endpoints.

With the app deployed you could now connect a front-end application using your own HTTP integration, but BrightWork has a quick and easy tool to get you building even faster. Check out the BrightWork JavaScript SDK and stay tuned for another tutorial on the JavaScript SDK coming soon!