programmati.ca Open Studio

Examples · Kanban board

A Trello-style kanban board: 42 lines of AppSPEC

A kanban board with drag-and-drop columns, an add-card form, an edit screen with delete, and a sortable list of every card. Create, move, update and delete are all declared on wires.

Running live in the sandbox with fixed demo data. Anything you add is saved in this browser; nothing leaves your device.

The state graph

3 screens, 3 wires

Screens are nodes and WIRE labels are edges. Screens in blue appear in the navigation; orange edges write a record on the way.

boardeditlistremoveadd-cardsave-card

How it works

Walking through the spec

01Screens are states

3 screens, each a <STATE>. board, list appear in the navigation because they carry a NAV label. Children lay themselves out by containment: ROW, COL and GRID arrange them, and everything else stacks.

<STATE ID="board" NAV ICON="kanban">
…
<STATE ID="edit" WIDTH="640px">
…
<STATE ID="list" NAV="All cards" ICON="list">

02Screens connect by label

Each <WIRE> names an action and where it leads; a button, card or row that fires the label follows it, taking the clicked record along. This app writes 1 wire out and uses the short forms OPEN, SAVE, UPDATE: OPEN="state" opens an item in that state, and FORM SAVE or UPDATE saves the form to a collection, with the engine adding the wire.

  <FORM SAVE="cards" SET="status=todo" COLS="3">
…
  <BOARD SRC="cards" COLUMNS="todo:To do,doing:In progress,done:Done" SUBTITLE="{owner}" BADGE="tag" OPEN="edit" />
…
  <FORM UPDATE="cards" TO="board" COLS="2">
…
  <TABLE SRC="cards" SORT="status" OPEN="edit">
…
<WIRE LABEL="remove" DELETE="cards" TO="board" />

03Data flows through the key-value pipe

Every input publishes its value into the pipe under its ID, and every screen can read the pipe with {placeholders}. Writes are declared on wires: remove delete cards, add-card save cards, save-card update cards. SET adds key-value pairs to the record being written.

<FORM SAVE="cards" SET="status=todo" COLS="3">

04One attribute sets the look

THEME="notion" sets every colour, radius and typeface. Change the word and the whole app restyles; all 31 themes work with every component.

<APP ID="kanban" NAME="Launch Board" THEME="notion" LOGO="kanban" WIDTH="1240px">

Convention over configuration

What the engine infers

Every attribute this spec leaves out has a default inferred from names, data and context. These are the ones this app relies on; writing any of them out would override it.

  • A WIRE add-cardThe FORM SAVE="cards" implies this wire
  • A WIRE save-cardThe FORM UPDATE="cards" implies this wire
  • STATE NAV → BoardNAV with no label uses the state ID, humanised
  • FORM ACTION → add-card, save-cardSAVE wires the form to the collection
  • FORM SUBMIT-LABEL → Add card, SaveFrom SAVE
  • FIELD LABEL → Tag, Owner, TitleFrom NAME
  • FIELD TYPE → selectIt has OPTIONS
  • BOARD ACTION → editOPEN="edit" opens the clicked item in that state
  • BOARD TITLE → titleThe records have a title field
  • BOARD GROUP → statusThe cards have a status field
  • A back linkA state opened with OPEN gets a back link
  • FIELD VALUE → {cards.title}, {cards.status}, {cards.tag}, {cards.owner}The record being edited
  • TABLE ACTION → editOPEN="edit" opens the clicked item in that state
  • COL LABEL → Tag, OwnerFrom FIELD

What this would typically take

The pieces a conventional stack needs

A typical implementation of the same app assembles these parts, each with its own code, libraries and configuration. The size depends on the team and the tools, so we do not quote a number for it.

Here the same app is one 42-line document built from general-purpose components: BOARD, BUTTON, FORM, TABLE, TEXT, TOTAL.

Drag and dropA drag-and-drop library, drop targets per column and keyboard alternatives.
CRUD APIEndpoints to create, move, update and delete cards.
FormsAdd and edit forms prefilled from the selected card.
StateKeeping the board, the list view and the edit screen in sync.
Build toolingA bundler, a dev server and a build configuration.
The full speckanban.appspec · 42 lines
The same spec with every inferred attribute written out (40 lines)
<APP ID="kanban" NAME="Launch Board" THEME="notion" LOGO="kanban" WIDTH="1240px">

  <STATE ID="board" NAV ICON="kanban">
    <ROW JUSTIFY="between">
      <COL GAP="2px">
        <TEXT STYLE="h1" TEXT="Launch board" />
        <TEXT STYLE="muted" TEXT="Drag cards between columns, or use the arrows. Every change is a key-value write." />
      </COL>
      <TOTAL SRC="cards" WHERE="status=done" OP="count" LABEL="Done:" />
    </ROW>
    <FORM SAVE="cards" SET="status=todo" COLS="3">
      <FIELD NAME="title" LABEL="New card" PLACEHOLDER="What needs doing?" REQUIRED />
      <FIELD NAME="tag" OPTIONS="Planning,Design,Engineering,Marketing" />
      <FIELD NAME="owner" PLACEHOLDER="Who?" />
    </FORM>
    <BOARD SRC="cards" COLUMNS="todo:To do,doing:In progress,done:Done" SUBTITLE="{owner}" BADGE="tag" OPEN="edit" />
  </STATE>

  <STATE ID="edit" WIDTH="640px">
    <TEXT STYLE="h1" TEXT="Edit card" />
    <FORM UPDATE="cards" TO="board" COLS="2">
      <FIELD NAME="title" REQUIRED />
      <FIELD NAME="status" LABEL="Column" OPTIONS="todo:To do,doing:In progress,done:Done" />
      <FIELD NAME="tag" OPTIONS="Planning,Design,Engineering,Marketing" />
      <FIELD NAME="owner" />
    </FORM>
    <BUTTON STYLE="danger" ICON="trash-2" LABEL="Delete" ACTION="remove" />
  </STATE>

  <STATE ID="list" NAV="All cards" ICON="list">
    <TEXT STYLE="h1" TEXT="All cards" />
    <TABLE SRC="cards" SORT="status" OPEN="edit">
      <COL FIELD="title" LABEL="Card" />
      <COL FIELD="status" LABEL="Column" TYPE="badge" />
      <COL FIELD="tag" />
      <COL FIELD="owner" />
    </TABLE>
  </STATE>

  <WIRE LABEL="remove" DELETE="cards" TO="board" />

</APP>