# Tutorial: your first app

> Build a small equipment loans app, add a page, then propose a change as a changeset, review it and apply it.

Source: https://docs.ligament.ai/get-started/first-app/

In this tutorial you build an **Equipment loans** app for an IT desk that lends laptops, headsets and cameras to staff. You create a record type with a few fields and a lifecycle, add a record, build an overview page with the page builder, and then take a change through a changeset: someone proposes it, you review it and apply it.

It takes about 20 minutes. You need to be a workspace owner or admin. Step 8 also uses a second person with access to Build but without the `build:pages` permission.

## 1\. Create the app

1.  Open **Build › Apps** and select **New app**.
2.  Enter the app name `Equipment loans`. The key fills in as `equipment_loans`. Keys are permanent, so change it now if you want a different one.
3.  Select **Create**.

The app opens on its **Overview** tab: its key, visibility (Private), latest version (Unpublished) and an empty **Data model** section.

## 2\. Add a record type

1.  Under **Data model**, select **New entity**.
2.  Enter the label `Equipment loan`. The key fills in as `equipment_loan`.
3.  Select **Add**.

The entity appears in the data model with one field, **Name**, which every entity starts with. Select **Equipment loan** to open its schema in **Build › Data**.

## 3\. Add fields

On the **Fields** tab, select **Add field** and fill in the panel for each of these fields, then select **Add field** at the bottom of the panel:

| Key | Label | Type | Other settings |
| --- | --- | --- | --- |
| `asset_tag` | Asset tag | string | Required |
| `borrower` | Borrower | reference | Reference entity `person`, display field `name` |
| `due_back` | Due back | date |  |
| `condition` | Condition on return | enum | Values `Good`, `Damaged`, `Missing` |

The list shows the five fields, and the **Relations** diagram above it shows the new link from Equipment loan to Person.

\[Screenshot: The Fields tab of the Equipment loan entity, listing Name, Asset tag, Borrower, Due back and Condition on return, with a relations diagram linking Equipment loan to Person\]

## 4\. Add a lifecycle

Open the **Lifecycle** tab.

1.  Select **Add state** three times and fill in the rows:
    
    | Key | Label | Colour | Kind |
    | --- | --- | --- | --- |
    | `requested` | Requested | yellow | initial |
    | `on_loan` | On loan | blue |  |
    | `returned` | Returned | green | terminal |
    
2.  Select **Add transition** twice: **Requested → On loan** with the action label `Hand over`, and **On loan → Returned** with the label `Mark returned`. Leave **anyone** as the required role.
    
3.  Select **Save lifecycle**.
    

State keys can’t be changed once saved; labels and colours can.

\[Screenshot: The Lifecycle tab with the states Requested, On loan and Returned and the transitions Hand over and Mark returned\]

## 5\. Lend a laptop

1.  Select **View records**. The list opens at `/r/equipment_loan`, and **Equipment loans** now has its own section in the navigation.
2.  Select **New equipment loan** and fill in the form: Name `Dell XPS 13 laptop`, Asset tag `NW-LT-0142`, Borrower `Tomás Ortega`, Due back a date two weeks out.
3.  Select **Create equipment loan**.

The record opens in the Requested state, with the lifecycle as a stepper and a **Hand over** button. Select **Hand over** when the laptop leaves the desk: the record moves to On loan.

\[Screenshot: The record page of Dell XPS 13 laptop in the Requested state, with the Hand over button and the asset tag, borrower and due date\]

## 6\. Build an overview page

Open **Build › Pages** and select **New page**. The page builder opens with a heading and a text block.

1.  In the **Page** panel on the right, set the key to `loans_desk`, the title to `Loans desk` and the description to `Equipment out on loan and what is due back.`
2.  Select the heading block on the canvas. On its **Content** tab, set the text to `Equipment on loan`.
3.  Select the text block and replace its text with a line for the desk, for example `Laptops, headsets and other kit lent to staff.`
4.  In the **Library** on the left, select **Metric**. On its **Content** tab set the title to `Loans`; on its **Data** tab set the entity to **Equipment loan (equipment\_loan)**. The measure is **Count of records**.
5.  Select **List** in the library. Set its title to `All loans` and its entity to **Equipment loan**. The builder picks the first three columns for you (name, asset\_tag, borrower).
6.  Switch the canvas from **Layout** to **Preview** to see the page with live data, as you would see it.

Now select **Plan**. The plan shows what applying the page would do:

```text
Create  __tenant__/page/loans_desk                    ✓ build:pages
This workspace
+ add heading
+ add metric
+ add list
+ add rich-text
```

Instead of applying it straight away, select **Save as changeset**. Nothing goes live yet: the builder now shows the badges **Draft · 1 change** and **Changeset Draft: Loans desk**.

## 7\. Review and apply the changeset

1.  Open **Build › Changes** and select **Draft: Loans desk**.
2.  Read the **Plan** tab. The **Impact** panel says whether you hold the permission the change needs (`build:pages`), whether it touches access rules or code, and which layer it writes.
3.  Select **Mark ready**. The status changes to **Ready for review**. In a team, this is the point where the person who built the page hands it to the person who approves it.
4.  Select **Apply**.

The changeset is now **Applied** and read-only, and its **Activity** tab records who created it, who marked it ready and who applied it.

Open **Build › Pages › Loans desk** and select **Open page**:

\[Screenshot: The live Loans desk page: the heading Equipment on loan, a Loans metric showing 3, and a list of three loans with asset tags and borrowers\]

## 8\. Take a change from someone else

Changesets matter most when the person who makes a change can’t apply it. In Northwind, Max has a “maker” role: he can use Build but doesn’t hold `build:pages`.

1.  Max opens **Build › Pages › Loans desk**, selects **Edit**, selects the **All loans** list and, on its **Data** tab, adds the column `due_back`.
2.  He selects **Plan**. The plan says *Applying needs build:pages, which you don’t hold. You can still save it as a changeset for someone who does (proposing is free).* He selects **Save as changeset**, then **Mark ready** in Build › Changes.
3.  You open the changeset in **Build › Changes**. The plan shows `~ list config changed` on `__tenant__/page/loans_desk`, and the Impact panel shows that you hold `build:pages`. Select **Apply**.

The page now shows the due-back date, and the page’s **History** tab lists both versions with who applied each one and from which changeset.

## Next steps

-   [Core concepts](https://docs.ligament.ai/get-started/concepts/index.md) explains apps, the spec store and changesets in one place.
-   [Page builder](https://docs.ligament.ai/guides/building-apps/page-builder/index.md) covers every block, filters, the JSON tab and custom components.
-   [Changesets](https://docs.ligament.ai/guides/building-apps/changesets/index.md) covers drafts, review and who may apply.
-   [Agents propose, people approve](https://docs.ligament.ai/guides/building-apps/agents-propose/index.md) shows how an AI agent can make the same kind of change with an API key.
-   [App manifests](https://docs.ligament.ai/developers/app-spec/index.md) shows how to write an app like this one as code and publish versions of it.
