Skip to content

App manifests

View as Markdown

An app manifest describes a whole app in one file: its record types and fields, their lifecycles and access rules, its automation and its pages. You keep the file in version control, validate it locally, publish it as a numbered version and install that version in a workspace. Use a manifest when an app should be reviewed like code, installed in several workspaces, or upgraded over time; for a one-off app in one workspace, Build › Apps is quicker.

The example below is a small Office moves app for a facilities team. Every field the manifest accepts is listed in the App manifest reference.

Install the CLI and work in a folder for your app. The CLI reads two settings, from the environment or from a .env file in the current folder:

Variable Value
LIGAMENT_URL Your workspace’s address, for example https://app.ligament.ai
LIGAMENT_API_KEY An API key. Publishing needs the apps:write scope and installing needs apps:install. These are admin scopes: only a workspace admin can create a key with them.

ligament app validate works without a key.

Scaffold a manifest:

Terminal window
ligament app init
✓ Created app.ts and .env
Next: set LIGAMENT_API_KEY (or ligament login), then ligament app publish.

app.ts holds a small example app to replace with your own. Fill in .env: set LIGAMENT_API_KEY, and set LIGAMENT_URL to your workspace’s address (the scaffold puts a local development address there).

The manifest is a TypeScript (or JavaScript) module whose default export is the app, wrapped in defineApp from @ligament/sdk for type checking:

app.ts
import { defineApp } from '@ligament/sdk'
export default defineApp({
key: 'office_moves',
version: '1.0.0',
releaseNotes: '1.0: first release: move requests, a three-step lifecycle and a moves overview page.',
editPolicy: 'full',
store: {
name: 'Office moves',
summary: 'Request, schedule and complete desk moves.',
description: 'Facilities track every desk move from request to done: who moves, from which desk to which, on what date and how many crates.',
category: 'Facilities',
icon: 'truck',
plans: [{ key: 'standard', name: 'Standard', isDefault: true }],
},
nav: {
label: 'Office moves',
icon: 'truck',
items: [
{ label: 'Moves', to: '/r/office_move', icon: 'list' },
{ label: 'New move', to: '/r/office_move/new', icon: 'plus' },
],
},
entities: [
{
key: 'office_move',
label: 'Office move',
description: 'One person moving from one desk to another.',
icon: 'truck',
backingTable: 'records',
fields: [
{ key: 'name', label: 'Summary', type: 'string', storage: 'ext', required: true, order: 0 },
{ key: 'employee', label: 'Employee', type: 'reference', storage: 'ext', order: 1, referenceEntityKey: 'person', referenceDisplayField: 'name' },
{ key: 'from_desk', label: 'From desk', type: 'string', storage: 'ext', order: 2 },
{ key: 'to_desk', label: 'To desk', type: 'string', storage: 'ext', required: true, order: 3 },
{ key: 'move_date', label: 'Move date', type: 'date', storage: 'ext', order: 4 },
{ key: 'crates', label: 'Crates', type: 'number', storage: 'ext', order: 5 },
{ key: 'scheduled_on', label: 'Scheduled on', type: 'date', storage: 'ext', order: 6 },
],
states: [
{ key: 'requested', label: 'Requested', color: 'yellow', isInitial: true, order: 0 },
{ key: 'scheduled', label: 'Scheduled', color: 'blue', order: 1 },
{ key: 'done', label: 'Done', color: 'green', isTerminal: true, order: 2 },
],
transitions: [
{ from: 'requested', to: 'scheduled', label: 'Schedule', runWorkflow: 'stamp-scheduled' },
{ from: 'scheduled', to: 'done', label: 'Complete' },
],
acls: [
{ operation: 'read', role: 'member' },
{ operation: 'create', role: 'member' },
{ operation: 'update', role: 'member' },
{ operation: 'transition', role: 'admin' },
],
},
],
pipelines: [
{
key: 'stamp-scheduled',
name: 'Stamp the scheduling date',
trigger: { type: 'manual', entity: 'office_move' },
nodes: [
{ id: 'stamp', kind: 'action', action: 'record.update',
params: { entity: 'office_move', id: '{{trigger.record.id}}', values: { scheduled_on: '{{now}}' } } },
],
},
],
pages: [
{
specVersion: 1,
key: 'office_moves_home',
title: 'Office moves',
description: 'Moves waiting to be scheduled and the ones coming up.',
blocks: [
{ id: 'intro', type: 'heading', props: { text: 'Desk moves' } },
{ id: 'waiting', type: 'metric', span: 4,
props: { entity: 'office_move', metric: 'count', caption: 'Waiting to be scheduled',
filters: [{ field: 'state', op: 'eq', value: 'requested' }] } },
{ id: 'upcoming', type: 'list', span: 12, title: 'Upcoming moves',
props: { entity: 'office_move', columns: ['name', 'employee', 'to_desk', 'move_date'],
sort: [{ field: 'move_date', dir: 'asc' }], limit: 10 } },
],
},
],
})
Field What it is
key The app’s permanent key, in lower_snake_case. It namespaces everything the app installs.
version A semantic version (1.0.0). Each published version is immutable.
releaseNotes Shown in the App Store and in the upgrade summary.
editPolicy How much installers may change what the app ships: full (default), additive or locked. See Upgrades and your customisations.
store The App Store listing: name, summary, description, category, icon and plans.
nav The app’s section in the navigation.
dependsOn Keys of apps that must be installed first. Installing from the App Store names them and installs them first.

Each entity is a record type. backingTable: 'records' stores its records in the workspace’s shared record store, so installing it needs no database change; give its fields storage: 'ext'. A field has a key, a label, a type (string, number, money, decimal, boolean, date, url, email, image_url, enum or reference; currency is the older float type that money replaces), its position (order) and optional settings such as required, enumOptions ([{ value, color, label? }]: label is what people see, else the value is humanized), for a reference referenceEntityKey and referenceDisplayField, or for money and decimal fields currency, currencyField, scale and rounding (see Money in the API). A reference can point at an entity of another app or module, such as person from People.

seed on an entity (or seedRecords on the app) creates starter records on install.

states lists the states in order; one has isInitial: true and terminal states have isTerminal: true. Each transition names its from and to states and an action label, and can require a role (requiresRole) or run one of the app’s pipelines (runWorkflow). Mark a transition that ends or undoes something (Retire, Cancel, Revoke) destructive: true: the record page never makes it the accent button and asks before running it, with your confirm question if you give one. Every state a transition names must be declared.

acls says which roles may read, create, update, delete or transition the entity’s records. A rule can also deny (effect: 'deny'), cover one field (fieldKey) or only rows matching rowFilters. Owners and admins always pass, so { operation: 'transition', role: 'admin' } keeps transitions to admins and owners.

On install, each role’s rules become a permission set in the workspace’s spec store, named <app>.<role>. For this app:

{
"key": "office_moves.member",
"origin": "app",
"role": "member",
"grants": [ { "entity": "office_move", "ops": ["read", "create", "update"] } ],
"app": "office_moves"
}

Admins can see and adjust them in Settings › Access; see Roles and permission sets.

For a full access model (your own roles and permission sets, restrictions such as “pay is masked except on your own record”, and the role that administers the app), ship it under the manifest’s access key instead. The install creates it, upgrades keep the workspace’s changes and never widen access without an admin’s approval, and uninstalling removes it. See Access in the manifest.

pipelines are the app’s automation, declared as data: a trigger and a list of nodes. In the example, the Schedule transition runs stamp-scheduled, which writes the date into scheduled_on. Inside a pipeline, {{trigger.record.id}} is the record that triggered it and {{now}} the current time. The published manifest carries pipelines in its workflows field.

A wait node can pause a pipeline until an event arrives: { id: 'answer', kind: 'wait', for: { event: 'ticket.answered', match: { recordId: '{{trigger.record.id}}' }, timeout: '3d' } }. Its output is the event, or empty when the timeout passes first. By default it waits for the next matching event. If the step before it sends a request that someone can answer at once, add lookback: true, so an answer that arrives before the wait starts still counts. lookback needs a match, and it counts any matching event since the pipeline started (never the event that started it). Don’t use it on a wait that means “the next update”, or an earlier update would end the wait.

pages are page documents, the same format the page builder edits and its JSON tab shows. They install as the app’s shipped pages, which workspaces can customise and keep across your upgrades.

Terminal window
ligament app validate
✔ App "office_moves" v1.0.0 is valid (1 entity, 1 pipeline(s), 0 grant(s))

Validation checks the shape of every field and the consistency between them, and exits with code 1 on any problem:

✖ Manifest invalid
✗ version: must be semver (e.g. 1.0.0)
✖ Manifest failed validation
✗ entity "office_move": transition.to "closed" is not a declared state
Terminal window
ligament app publish
✔ Published office_moves v1.0.0
Install it with ligament app install office_moves

A published version can’t be changed or published again:

✖ Publish failed (409)
{"error":"Version 1.0.0 already published for \"office_moves\""}

To ship a change, raise version (1.1.0) and publish again, or pass --version 1.1.0 to app publish. Write releaseNotes for each version: installers see them before they upgrade.

Release notes: every version bump adds a line. Start releaseNotes with an entry for the new version, the version and a colon, and keep the older entries after it, newest first: '1.1.1: fixes the moves overview total. 1.1: floor changes. 1.0: first release.' For a x.y.0 version, x.y: is enough (1.1: for 1.1.0); a patch version needs the full number (1.1.1:). The apps in the Ligament repository are checked for this rule by a test (release-notes-lint), so a version bump without its line fails the build. Because a published version can’t change, fixing forgotten notes means a new patch version with its own line.

Terminal window
ligament app install office_moves
✔ Installed office_moves v1.0.0

ligament app install office_moves@1.0.0 installs a specific version. The app’s entities, fields, lifecycle, permission sets, pipelines and pages are created, and its section appears in the navigation.

ligament app list shows your apps with the latest published version and the version installed in this workspace:

office_moves (latest v1.2.0) installed v1.2.0

Workspaces that have the app installed upgrade from the App Store (Updates available) or with POST /api/apps/upgrade. Their changes to your pages are kept and merged with your new version; see Upgrades and your customisations. ligament app uninstall office_moves disables the app in a workspace.

All the app commands are in the CLI reference.