Runtimes
Web triggers
Async functions
Product REST APIs
Fetch APIs

Overview

Serverless functions are an integral part of the Forge platform, enabling developers to create custom, scalable applications that interact and extend seamlessly with Atlassian's suite of products. Functions underpin many other foundational capabilities of the platform, including UI backend resolvers, product events, and more.

Basic usage

Creating a function

Dependencies

The following dependency should be installed at the top-level directory of your app:

1
2
npm i @forge/api@latest

File structure

The following directory and function entry point file should be added to your app /src folder:

1
2
/src
  /backend
    /index.js

Handler

The following function handler should be defined in the /src/backend/index.js file:

1
2
export const handler = (...args) => {
  console.log(args);
  // Do something
}

See Arguments for the schema of ...args.

Manifest definition

The following function should be declared in the app manifest:

1
2
modules:
  function:
    - key: backend
      handler: index.handler

Attaching a function to a module

To enable your function to run, it needs to be attached to a module via the app manifest. For example, a scheduled trigger:

1
2
modules:
  scheduledTrigger:
    - key: example
      function: backend
      interval: hour # Runs hourly

See common modules for a complete list of backend entry points.

Rate this page: