Course menuForge Cloud

Level 1 · Basic

Getting started with Forge

About three hours. Add a panel to every repair task in Jira that reads the car from the task’s title and shows what that model comes in, from an outside car data service. On the way you learn how a Forge app is put together, how it gets onto a site, and how it keeps its secrets safe.

What you’ll build

Spaces / Workshop / WS-1

BMW 3 Series – grinding noise from front

⌄ Key details

Description

Grinding noise from the front wheels when braking. Customer drops the car off on Tuesday morning.

Car details

BMW 3 Series since 1987

Repair: grinding noise from front

  • Fuel: Petrol, Diesel, Hybrid
  • Transmission: Automatic, Manual, Dual-clutch
  • Drive: Rear-wheel, All-wheel, Four-wheel
  • Cylinders: 4, 6, 3
  • Versions: 320d, 320i, 2.0, 330i, 330d
A sketch of a Jira work item, not a real screen. The panel under the description is what you build in Level 1.

A panel called Car details on every repair task in your Workshop space in Jira. Each repair task’s title starts with the car, such as BMW 3 Series – grinding noise from front. The panel reads the make and model from that title, asks an outside car data service (API Ninjas) what that model comes in, and shows it: the fuels, gearboxes, driven wheels, engine cylinders and most common versions. When something goes wrong, it says what, in plain words.

Behind the card:

  • The API Ninjas key sits in an encrypted variable.
  • The app may only call the hosts and read the data its manifest lists.
  • A trigger, which the course calls the bell, runs by itself whenever a new repair task is created, to check that the car data service knows the car.

Plan on about three hours, with breaks. Every lesson ends with the code as it should be, to download if you fall behind.

How the Level 1 app works

This is the same diagram as on the home page, with what Level 1 adds drawn on top: the encrypted variable, API Ninjas, product triggers and logs. Scroll, and the step you are reading lights up its part of the diagram while each kind of data moves along the arrows as its own shape. The lessons link back to the step that shows what they build.

What the Level 1 app does

  • Request
  • Secret
  • Outside answer
  • Return value
  • Jira or Confluence data
  • Event

The panel calls invoke(), and the resolver takes the request.

Runs in the browser

Issue panel The car details card

A module that adds your UI to the work item view, below the description.

Select any box in the diagram to see what it is.

  1. Chapter 1 of 3

    What happens when someone opens a work item

  2. Step 1 of 4 · Request

    Request. When someone opens a work item, the car details card in the panel sends a named request with invoke(), and the resolver in the Atlassian cloud picks it up.

    Runs in the browser

    invoke()

    invoke('name', …) is how the screen part of the app asks the cloud part for something by name, then waits for the answer. Think of an automation rule that sends a web request and waits for the reply. The browser never talks to Jira or outside services directly; it always asks the cloud part.

    Further reading, optional: Atlassian docs on Bridge API (opens in a new tab)

  3. Step 2 of 4 · Secret

    Secret. The resolver reads the API Ninjas key from an encrypted variable with process.env, which is how cloud code reads an encrypted variable by its name. The key stops there: it never travels on to the browser.

    Runs in the Atlassian cloud

    Environment variablein the workshop: the key safe

    A value stored with the app in Atlassian’s cloud, such as the car service’s key. Saved encrypted, it can be read by the app’s cloud code but by nobody else, so the key is never written into the code.

    Explained in Level 1, lesson 3
  4. Step 3 of 4 · External call

    External call. The resolver asks API Ninjas about the car with fetch(), which is how code asks a website for something and waits for the answer, like the Send web request action in an automation rule. Forge allows it only because manifest.yml lists that service’s address.

    Declared in manifest.yml

    Egress permissionin the workshop: approved services

    The list of outside addresses the app may call, written in the manifest. Like a firewall allow-list: anything not on it is blocked, and admins see the list before they approve the app.

    Explained in Level 1, lesson 4
  5. Step 4 of 4 · Return

    Return. Once the key and the car data have come back, the resolver sends one answer to the panel on its own arrow, and the card shows the car. For now the resolver always looks up the same car, a BMW 3 Series.

    Runs in the browser

    UI Kit

    Ready-made screen parts from Atlassian, such as headings, lists, tags and messages. Panels built with them look and behave like the rest of Jira, including dark mode.

    Explained in Level 1, lesson 2
  6. Chapter 2 of 3

    Reading the car from the repair task

  7. Step 1 of 2 · Jira read

    Jira read. Lesson 6 makes the card show the car from its own repair task. Now, when the card asks, the resolver first reads the work item’s title with asUser(), so it sees only what the person looking at the work item is allowed to see. The make and model come from that title.

    Runs in the Atlassian cloud

    asUser()in the workshop: on your own login

    The app reads Jira as the person using it, with exactly their permissions, the same ones your permission schemes give them. The first time, Jira asks that person to allow the app to act for them.

    Explained in Level 1, lesson 6

    Declared in manifest.yml

    Scopein the workshop: a line on the signed approval

    A scope is one permission the app asks for, such as reading work items. Scopes are what the admin sees and approves on the install screen. Forge refuses any request the scopes don’t cover, even if the person could do it themselves.

    Explained in Level 1, lesson 6
  8. Step 2 of 2 · The right car

    The right car. The resolver takes the key from the encrypted variable as before and asks API Ninjas about the car named in the title. Its one answer now carries the car data and the title to the panel, so each repair task shows its own car.

  9. Chapter 3 of 3

    When a work item is created

  10. Step 1 of 1 · Product trigger

    Product trigger. When someone creates a work item, Jira sends an event to the app’s product trigger, which runs a function on its own, with nobody looking at a card, and that function writes what it did to the logs.

The lessons

  1. Lesson 0: Get ready for Level 1Get everything Level 1 needs on top of the general setup.
  2. Lesson 1: Create the appCreate a Forge app from the Jira issue panel template, deploy it, install it on your developer site and see its panel on the BMW 3 Series repair task.
  3. Lesson 2: Work from your laptopRename the panel, then lay out a sample car details card with UI Kit while forge tunnel shows every save on the site, without a deploy.
  4. Lesson 3: Lock the key in the safeStore the API Ninjas key as an encrypted variable before any code uses it, so it never sits in a file, a commit or the browser.
  5. Lesson 4: Look up the carWrite a small code file that asks API Ninjas what a car model comes in, have the resolver use it, let the card ask for it, and add API Ninjas to the app’s approved services.
  6. Lesson 5: Lay out the car details cardMake the resolver report problems instead of failing silently, then give the card a waiting state, an empty state, an error state and the full specs.
  7. Lesson 6: Read the repair taskRead the car from the work item’s own summary, as the person looking at it, and let forge lint add the permission that needs.
  8. Lesson 7: Hang the bellRun code when a repair task is created, with nobody looking at a card, and read what it did in the workshop log.

Type at least two letters.