Local Development with the Fusebit CLI

The Fusebit CLI is a powerful tool that can be used by members of your team to develop or manage Fusebit functions. You can also expose the tool to the users of your platform.

In order to use the tool, you must have been granted sufficient access permissions.


All fuse function commands described below allow a great degree of customization using options not covered in this article. Type fuse function {command} --help to get more detailed information on available options.

Development Cycle Overview

Fusebit functions must be saved to disk to enable local development. You can save a function in two ways: scaffold a brand new function using fuse function init, or download an existing function with fuse function get -d. After making any changes, you can deploy a function from disk to the Fusebit platform using fuse function deploy. At any time you can list functions that are deployed using fuse function ls. You can also receive real-time logs generated by your functions with fuse function log.

Scaffolding a New Function

You can scaffold a brand new Fusebit function to the hello_world directory by executing:

fuse function init hello_world

This will create the hello_world directory if it does not yet exist and add the following files and directories within it:

  • index.js: the main entry point to the function
  • package.json: allows you to declare NPM module dependencies and select Node.js engine version
  • .env: allows you to specify configuration parameters for the function
  • fusebit.json: contains advanced options and metadata used by the Fusebit CLI and editor

The directory also includes a .gitignore file that excludes the .env file from being stored in Git in case this is where you want to keep the function code.

You can add additional files to the directory containing your function, but they all must be stored at the same level as index.js. Subdirectories are ignored when you later run fuse function deploy.

Downloading an Existing Function

If the hello-world Fusebit function already exists, you can download it to hw directory with:

fuse function get hello-world -d hw

The layout of the files is the same as in case of new function scaffolding.

You can inspect an existing function without downloading it with fuse function get hello-world.

Deploying a Local Function

You can deploy a local function to the Fusebit platform by going to the directory containing the function and executing the fuse function deploy command with the function name:

fuse function deploy hello-world

Setting Advanced Compute Options

There are a handful of advanced compute options that can be configured via the fusebit.json file. These include the following options that can be set via the compute object:

  • timeout: set the max timeout of a function in seconds; must be a number between 1 and 120; default is 30
  • memorySize: set the max memory usage of a function in MB; must be a number between 64 and 3008; default is 128
  • staticIp: set to true to indicate that all network traffic made from the function should use a static IP; useful when the IP needs to be whitelisted

Note: Setting staticIp to true may noticeably increase the cold-start latency of the function. It is strongly recommended to only set staticIp to true for functions that execute on a CRON schedule.

Here is an example of a fusebit.json file in which both the timeout and staticIp values are configured:

  "fuseVersion": "1.0.1",
  "compute": {
    "timeout": 90,
    "staticIp": true
  "metadata": { ... }

Real-time Logs

All information your function generates using console.log or console.error can be streamed in real time to the console using fuse function log.

You can stream real-time logs at the boundary or function level. It you attach to the boundary level stream with:

fuse function log

you will receive real time logs from all functions running in a particular boundary. If you select a specific function with:

fuse function log hello-world

You will only receive real time logs from that particular function.

Real-time logs are also available within the Fusebit editor.

Editing a Fusebit Function in the Browser

In addition to supporting local development, Fusebit CLI also makes it easy to edit a deployed function using the Fusebit editor. To launch the Fusebit editor in your default browser to edit the function hello-world, run this command:

fuse function edit hello-world

The Fusebit CLI will host a local HTTP server that serves the Fusebit editor configured to edit the hello-world function, and open your default browser pointing at that application.

You can run just fuse function edit from a local directory containing a Fusebit function to edit or inspect the deployed version of the function. Keep in mind, however, that any changes you make to the cloud version are not automatically reflected in the version on disk. You must explicitly run fuse function get -d to download the deployed function to disk again.

Running fuse function edit my-function when the my-function does not exist will automatically create it. This is an easy way to scaffold new functions directly on the Fusebit platform in the cloud.