Last updated Jul 30, 2021

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 the Jira REST API.
  3. Change the frontend with the UI kit: describes how to use UI kit 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.

Note, Forge apps can't be viewed by anonymous users. To use a Forge app, you must be logged in to Jira.

Create your app

Create an app based on the Jira issue panel template.

Note, Forge provides multiple environments where you deploy the app. This tutorial uses the CLI default, the development environment. Learn more about staging and production environments.

  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:

    forge create
    1. Enter a name for your app (up to 50 characters). For example, hello-world-app.
    2. Select the UI kit category.
    3. Select the jira-issue-panel template.
  3. Change to the app subdirectory to see the app files:

    cd hello-world-app

jira-issue-panel template

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

|-- src
|   `-- index.jsx
|-- manifest.yml
|-- package.json
|-- package-lock.json

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

You can view and manage your app in the developer console.

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:

    - key: hello-world-app-hello-world-panel
      function: main
      title: Forge app for Mia
    - key: main
  id: '<your app id>'
  name: hello-world-app

Install your app

To use your app, it must be installed onto an Atlassian site. The forge deploy command builds, compiles, and deploys your code, and reports any compilation errors. The forge install command then installs the deployed app onto an Atlassian site with the required API access.

Note, you must run the forge deploy command before forge install because an installation links your deployed app to an Atlassian site.

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

    forge deploy
  2. Install your app by running:

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

      Note: Running the forge install command only installs your app onto the selected product. To install onto multiple products, repeat these steps again, selecting another product each time.

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

      View a list of your active sites at Atlassian administration.

Once the successful installation message appears, your app is installed and ready to use on the specified site. You can always delete your app from the site by running the forge uninstall command.

View your app

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

  1. Create a new Jira issue. Learn more about Jira issues.
  2. View the issue you created. The app is shown in an issue panel after clicking the Forge app for Mia button. Once expanded, the app displays on the issue, like the example below.
  3. To view new changes in your app, you'll need to run forge deploy again, or run forge tunnel. This will be explained fully in the next section.

A Jira issue displaying the hello world forge app

Note, while your app is deployed to either a development or staging environment, (DEVELOPMENT) or (STAGING) will appear in your app title. This suffix is removed once you've deployed your app to production.

Deploy app changes

Once your app is installed, it will automatically pick up all minor app deployments so you don't need to run the forge install command again. Minor deployments are changes that don't modify app permissions in the manifest.yml file. You can deploy the changes onto your developer site by using one of two methods:

  • Manually, by running the forge deploy command.
  • Automatically, by running the forge tunnel command.

Tunneling allows you to speed up development by avoiding the need to redeploy each code change, and by seeing each invocation as it executes. The Forge tunnel works similarly to hot reloading, so any changes you make to your app code can be viewed on your Atlassian site without losing the current app state. You don’t need to run any other commands; you only need to refresh the page.

To use the forge tunnel command, Docker must be set up and running. To learn about Docker, visit the Docker getting started guides. If you don't want to run Docker, you can redeploy your app after each code change with the forge deploy command.

  1. Once Docker is set up, you can start tunneling by running:

    forge tunnel

    You should see output similar to:

    Running your app locally with Docker. The tunnel displays your usage from everywhere the app in the development environment is installed.
    Press Ctrl+C to cancel.
    Checking Docker image... 100%
    Your Docker image is up to date.
    Listening for requests on local port 37363...
    Reloading code...
    App code reloaded.

    You can now automatically deploy changes to your codebase and install packages, while tunneling. These changes appear on the Atlassian site where your app is installed.

  2. When you are ready to close the tunnel, press Control + C.

Note, the forge tunnel command only forwards traffic when the user in Jira or Confluence matches the Forge CLI user. For security reasons, you can’t see the traffic of other users.

Next step

In the next tutorial, you'll learn how to make API calls to Jira using Forge. This tutorial uses the forge tunnel, so make sure you are familiar with using this command.

A button to go to the next tutorial

Rate this page: