Last updatedMar 27, 2020

Rate this page:

Part 1: Build a Jira hello world app

This tutorial walks through creating a Forge app to display content on a Jira issue.

There are three parts to the tutorial:

  1. This page: describes creating, changing, and installing a simple hello world app. The focus is on learning the CLI commands needed to work with apps.
  2. Call a Jira API: describes how to make API calls to Jira with Forge and use the tunnel command.
  3. Change the frontend with Forge UI: describes how to use the Forge UI components.

We recommend you work through all three parts to get a good understanding of how to develop apps with Forge.

Before you begin

Complete Getting started before working through this page.

Create your app

Create an app based using the Jira issue panel template.

Note, Forge provides multiple environments where you deploy the app. This tutorial uses the CLI default, the development environment. See Environments to learn more.

  1. Navigate to the directory where you want to create the app. A new directory with the app’s name will be created there.
  2. Create your app by running:

    1
    forge create
    1. Enter a name for your app. For example, hello-world-app.
    2. Select the jira-issue-panel template.
  3. Change to the app subdirectory to see the app files.

    1
    cd hello-world-app

The CLI displays the following error after running forge create if you don't have the permissions required to create Forge apps:

1
Error: Account does not have app creation enabled...

To get the required permissions, reach out to the #help channel in the Forge Slack and provide the error message and your email address.

jira-issue-panel template

The jira-issue-panel template uses Node.js and has the following structure:

1
2
3
4
5
6
7
hello-world-app
|-- src
|   `-- index.jsx
|-- manifest.yml
|-- package.json
|-- package-lock.json
`-- README.md

Let’s have a look at what these files are:

  • index.jsx: Where you write the behavior of the app.
  • manifest.yml: Describes your app. It contains the name and ID of your app, along with the modules it uses. This app displays an issue panel on all Jira issues and has a function that provides the contents of the panel.
  • package.json: The app’s Node.js metadata. See the Node documentationfor more information.
  • package-lock.json: Records the version of the app’s dependencies.
  • README.md: Information about the app. We recommend updating this as you change the behavior of the app.

Change the panel title

This app displays content in a Jira issue panel using the jira:issuePanel module. Jira shows the title of the jira:issuePanel as the panel's heading. Let's change the title to include your name.

  1. In the app’s top-level directory, open the manifest.yml file.
  2. Find the title entry under the jira:issuePanel module.
  3. Change the value of title from hello-world-app to Forge app for <your name>. For example, Forge app for Mia.

Your manifest.yml file should look like the following, with your values for the title and app ID.

1
2
3
4
5
6
7
8
9
10
11
12
modules:
  'jira:issuePanel':
    - key: hello-world-app-hello-world-panel
      function: main
      title: Forge app for Mia
      description: A hello world issue panel.
  function:
    - key: main
      handler: index.run
app:
  id: '<your app id>'
  name: hello-world-app

Deploy and install your app

Any time you make changes to the code you'll need to deploy your app, with the forge deploy command. This command builds your code and reports any compilation errors.

Install your app, with the forge install command, when you want to install your app on a new site. Note, once the app is installed on a site, the site picks up the new app changes you deploy without needing to run the install command again.

  1. Navigate to the app's top-level directory and deploy your app by running:

    1
    forge deploy
  2. Install your app by running:

    1
    forge install
    1. Select your Atlassian product using the arrow keys and press the enter key.

      Note: Running forge install command installs your app in all available Atlassian products on the site. You don’t need to run the command for each product.

    2. Enter the URL for your development site. For example, example.atlassian.net.

    3. Open the authorization URL in your default browser from the CLI by pressing any key.
    4. Review the app's requested access.
    5. Select your Atlassian cloud site from the Authorize for list, then select Accept.

View your app

With your app installed, it’s time to see the app on an issue.

  1. Create a new Jira issue.
  2. View the issue you created.

The app should display on the page like the image below.

A Jira issue displaying the hello world forge app

Next step

See Part 2: Call a Jira API to learn how to make API calls to Jira with Forge.

Rate this page: