Documentation


Getting Started - Intro

Backbench is a platform that provides users with a workbench and toolbox containing programmable, managed and standards-compliant systems necessary to build even the most sophisticated backends.

It is a rapid prototyping platform, where users can program and publish internet-scale applications in seconds which we achieve by reducing the problem of developing and provisioning them to a mere configuration of well behaved abstract systems. It ships with its own programming language that is built from the ground up to make it simple to process information, program and integrate systems on the internet.

It is designed to and works seamlessly with existing "things" on the internet, making it trivial to develop custom workflows like tailoring a cloud automation and orchestration solution.

UI Workflow

How to perform common and useful activities within the Backbench UI!

Step 1: Create an Account

The first thing you need to do to get started with Backbench is Sign up for a free Account.

...

To create a account

  1. Sign up by giving your email and an username.
  2. Click Sign up or hit Enter.
  3. Check the verification mail sent to your email and set the password.
  4. Sign In with your password.

Step 2: Create a Bench

A bench is much like a project that brings together modules, endpoints, memory, schedules, graphs and logs in one place. You can create as many benches as you want, and they all remain isolated letting you try new ideas fast. Once signed in, you will be by default taken to the ‘Home’ page that lists all your benches.

...

To create a new bench

  1. Select +, in the upper right corner.
  2. Name your bench, for example, say “Counters” and select CREATE or hit Enter.

Step 3: Create a Module

A module lets you express business logic in the form of functions that can be used anywhere in the platform from handling HTTP requests to generating data for graphs. The functions are written in BBLANG, a simple language for processing information. You can create as many modules as you want, and move functions from one module to another as you wish.

...

To create a new module

  1. Select +, in the upper right corner.
  2. Name your module, for example, say “handlers” and select CREATE or hit Enter.

You will be taken to the editor automatically. Write your business logic and Select Save. You can update the module by selecting the folder to open the editor. Select the right corner of the module to rename, or to delete.

Example module:

counter:reset() => {
    bb:mem:set("music", 0);
    bb:mem:set("movies", 0);
    bb:mem:set("games", 0);
    bb:log("counter reset");
    return @ok;
}

//HTTP Handler
counter:count(req, section) => {
    bb:mem:set(section, bb:mem:get(section) + 1);
    bb:log("Section " + section + " visited");
    return @ok;
}

//Graph
counter:visualize() => {
    return [
        ["section", "count"],
        ["music", bb:mem:get("music")],
        ["movies",  bb:mem:get("movies")],
        ["games",  bb:mem:get("games")]
    ]
}

Step 4. Setup HTTPS Endpoint

Backbench provides a fully functional HTTPS endpoint that is suitable for publishing internet-scale APIs and writing custom workflows on the internet, like cloud automation, orchestration, DevOps, continuous delivery, and deployment. Every bench contains a single HTTP endpoint addressed by default as https://<username>-<benchname>.backbench.io, which is displayed on the top bar.

You can respond to HTTP requests by setting up a handler, providing a path pattern and the function to invoke. Whenever a HTTP request matching the path is made, the corresponding handler function is invoked with the request information as argument. When multiple handlers are registered for the same path, the first one to match is selected. You can also optionally enable the CORS setting that automatically adds the Access-Control-Allow-Origin header for accessing your API from the browser.

...

To create a new handler

  1. Select Endpoints on the left panel.
  2. Select +, in the upper right corner.
  3. Give a Path. For example, say /reset.
  4. Click on the field under the tag Handler and select the module function to be assigned. For example counter:reset, and select CREATE.

Use the following handlers to setup the counter example:

/reset                 counter:reset
/count/:section        counter:count

Once the handlers has been assigned, you can make a request by selecting the HTTP endpoint which is displayed on the top bar and paste it in a new window.

To reset the counter use /reset at the end of the endpoint:

https://<username>-<benchname>.backbench.io/reset

To record an entry use /count followed by /music /movies /games resepectively at the end of the endpoint:

https://<username>-<benchname>.backbench.io/count/music

https://<username>-<benchname>.backbench.io/count/movies

https://<username>-<benchname>.backbench.io/count/games

Step 5. Memory

A production scale fully managed key-value store (No-SQL database) that requires absolutely no configuration and is fully programmable, making it easy to store and access data in your application. All you need to do is use the “bb:mem” module.

To make use of memory

  1. Use the functions bb:mem:set and bb:mem:get for setting and getting values respectively. The set function takes a key and value, while the get function requires only the key to be supplied.
  2. Select Memory on the left panel to view the data you have stored in your bench.

Step 6. Activate Schedules

Backbench provides you the ability to run tasks at a certain time or in a recurring fashion, ideal for setting up custom marketing campaigns and building custom workflows.

...

To create a new schedule

  1. Select Schedules on the left panel.
  2. Select +, in the upper right corner.
  3. Give Schedule a name.
  4. Click on the field under the tag Target and select the function to be triggered. For example, counter:reset.
  5. Click on the field under the tag Recurrence and Select one of the recurring fashion Hourly, Daily, Weekly, or Monthly. (For now select daily)
  6. Now click on create to activate the schedule.

The above example sets up a schedule to clear the counters everyday. Once the module function has been assigned and the job is scheduled, you can see the last run and next run information on the same line. You can schedule multiple tasks by selecting the + icon and delete by selecting the Delete icon.

Step 7. Create a Graph

Backbench lets you visualise just about anything happening in your entire application from app downloads, page visits to custom system level metrics by providing powerful visualisations with programmable data sources that run in the context of your application.

Backbench uses Google Charts to render your charts and expects the return value of the data source function to be in their DataTable format https://developers.google.com/chart/interactive/docs/datatables_dataviews

...

To create a new Graph

  1. Select Graphs on the left panel.
  2. Select +, in the upper right corner.
  3. Give a graph name.
  4. Select the module function to be assigned in the Data Source field. For example counter:visualize.
  5. Select a graph type. For example, Line, Bar, Pie, Column, etc, and select CREATE.

Once the graph is created, you can see the graph changing in real-time, get insight, and act accordingly to improve customer experience, enhance business processes, and gain a competitive edge.

Step 8. Generate Logs

Backbench also provides a fully featured logging system that helps you gain a better understanding of the flow of your application. It helps you manage complexity and allows you to rapidly develop and debug your internet application.

...

To create a new Log

  1. Use the function bb:log to log values at anytime.
  2. Select Logs on the left panel to view logs.

Once you run your code, check the logging page for information such as Date and time at which the module function was accessed, the module function name for which the log has been generated and the logged message. The example code logs page visits and also whenever the counters are reset.

Getting started with backbench