|
| 1 | +# Application builder — UI design |
| 2 | + |
| 3 | +**Status**: Living design doc (draft, 2026-07-01). Companion to |
| 4 | +[ADR-0084](../adr/0084-application-builder-information-architecture.md). The ADR |
| 5 | +records the *decisions and rejected alternatives* (the information architecture); |
| 6 | +this doc records *how it looks and flows* — it iterates as the UI is built, and is |
| 7 | +not a binding contract. |
| 8 | + |
| 9 | +The atomic config panels (object designer, field editor, validation-rule editor, |
| 10 | +form designer, …) already exist. This doc is about the **overall layout** that |
| 11 | +composes them into one coherent builder, optimized for operation experience. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 1. The shell (every pillar shares it) |
| 16 | + |
| 17 | +``` |
| 18 | +┌───────────────────────────────────────────────────────────────────┐ |
| 19 | +│ app ▾ Data · Automation · Interface · Access ⚙ Save · Publish │ ← top bar |
| 20 | +├─────────┬───────────────────────────────────────────┬──────────────┤ |
| 21 | +│ left │ main (the work surface) │ right │ |
| 22 | +│ rail │ │ inspector │ |
| 23 | +│ │ grid / canvas / builder / matrix │ = selected │ |
| 24 | +│ entities │ + a per-entity facet tab bar (see Data) │ item's │ |
| 25 | +│ + search │ │ config │ |
| 26 | +│ + new │ │ (non-block) │ |
| 27 | +├─────────┴───────────────────────────────────────────┴──────────────┤ |
| 28 | +│ breadcrumb · hints │ |
| 29 | +└───────────────────────────────────────────────────────────────────┘ |
| 30 | +``` |
| 31 | + |
| 32 | +- **Top bar** — the four pillar tabs (Data / Automation / Interface / Access), the |
| 33 | + ⚙ Settings entry, the app switcher, and the draft indicator + Save draft / |
| 34 | + Publish (draft-gated, ADR-0033). |
| 35 | +- **Left rail** — the current pillar's primary entities (objects / automations / |
| 36 | + surfaces / roles), with search and New. Collapsible. |
| 37 | +- **Main** — the pillar's primary work surface, shaped to the pillar (Data = grid, |
| 38 | + Automation = canvas, Interface = builder/source, Access = matrix). |
| 39 | +- **Right inspector** — a *persistent, consistent* slot that shows the config panel |
| 40 | + for whatever is selected in the main zone. Non-blocking (the main surface stays |
| 41 | + visible); slides in on select, closable. This is the universal "inspector" |
| 42 | + (Figma / Retool pattern). |
| 43 | + |
| 44 | +## 2. Design principles (for best operation experience) |
| 45 | + |
| 46 | +1. **Consistent three zones across all four pillars** — rail / main / inspector. |
| 47 | + Muscle memory: config is always on the right, entities always on the left. |
| 48 | +2. **Facet = tab, item = inspector.** Tabs switch *which facet* of an entity you're |
| 49 | + on (an object's Records / Fields / Validations …); the right inspector configures |
| 50 | + the *selected item* within that facet (a field, a rule, a node). They coexist. |
| 51 | +3. **The default tab is the primary surface, not a demoted one.** In Data the first |
| 52 | + tab is `Records` (the grid) — you always land on the data; tabs make the other |
| 53 | + facets one click away without burying the grid. |
| 54 | +4. **Small config → inspector; big designer → main.** A field / rule / node / |
| 55 | + component configures in the right inspector. A full designer (form designer, |
| 56 | + flow canvas) *is* the main zone. |
| 57 | +5. **Two doors, one metadata.** An object-scoped surface that lives in another |
| 58 | + pillar (an object's Actions, Hooks, Views, Permissions) is reachable from the |
| 59 | + object (in-context, scoped) AND from its pillar (the cross-object lens). The |
| 60 | + metadata is stored once; there are two navigational entries, no duplication. |
| 61 | +6. **Same renderer.** The builder manipulates the same live artifact the end user |
| 62 | + sees (edit a field on the real grid; set a permission on the real matrix). This |
| 63 | + is also what keeps AI authoring safe — the agent edits the same flat, explicit |
| 64 | + metadata a human does. |
| 65 | +7. **No modals.** Config surfaces in the inspector or as a focused sub-view with a |
| 66 | + breadcrumb; the work surface never fully disappears. Draft/publish is always |
| 67 | + visible. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## 3. Data pillar |
| 72 | + |
| 73 | +Data is the **object-model workbench**: define objects, their fields, relationships, |
| 74 | +validations, and work with records. Data owns the *data layer*; presentation (saved |
| 75 | +views, kanban, calendar, forms, dashboards) belongs to Interface. |
| 76 | + |
| 77 | +### Layout |
| 78 | + |
| 79 | +``` |
| 80 | +┌ objects ─┬ Task ┈ Records · Fields · Validations │ Actions · Hooks · ⋯ ┬ inspector ┐ |
| 81 | +│ Account │ ┌ filter · sort · hide ─────────────────────────────────┐ │ Edit field │ |
| 82 | +│ Task ◄ │ │ # Title Status [Priority ▾] + │ │ Priority │ |
| 83 | +│ Project │ │ 1 Audit IA In review ● Medium │ │ type: select│ |
| 84 | +│ Invoice │ │ 2 Design system In progress ● High │ │ options … │ |
| 85 | +│ + New │ │ + New record │ │ required │ |
| 86 | +└──────────┴─┴───────────────────────────────────────────────────────┴─┴────────────┘ |
| 87 | +``` |
| 88 | + |
| 89 | +### Left rail |
| 90 | +The app's objects (v1: owned objects only), with search + New object. |
| 91 | + |
| 92 | +### Object facet tabs |
| 93 | +Per selected object, a tab bar of its facets — grouped: |
| 94 | + |
| 95 | +- **Schema** (authored in Data): `Records` · `Fields` · `Validations` · `Relationships` · `Lifecycle` |
| 96 | +- **Behavior**: `Actions` (Automation) · `Hooks` (Advanced) |
| 97 | +- **⋯ More**: `Views` · `Forms` (Interface) · `Permissions` (Access) · `Settings` · `Indexes` |
| 98 | + |
| 99 | +`Records` is the default. Cross-pillar tabs carry a pillar tag and open **in-context, |
| 100 | +scoped to this object** (their pillar is the cross-object lens — two doors, §2.5). |
| 101 | + |
| 102 | +Note: `Actions` / `Hooks` / `Validations` are the three authoring surfaces for logic |
| 103 | +on an object, routed by intent per [ADR-0077](../adr/0077-authoring-surface-boundary-hook-flow-validation.md): |
| 104 | +declarative validation · user-triggered action · write-path hook. |
| 105 | + |
| 106 | +### Main zone (content of the active tab) |
| 107 | +| Tab | Main-zone content | |
| 108 | +|---|---| |
| 109 | +| **Records** | the functional **grid** — columns = fields, rows = records, inline edit, `+` add field (column header menu configures it), `+ New record`, ephemeral filter/sort/hide/group (not saved — saved views are Interface). | |
| 110 | +| **Fields** | the **field manager** — a searchable vertical list (add without horizontal scroll, drag-reorder, type icons). Grouping into sections is *not* here — that is the form designer (layout is Interface). | |
| 111 | +| **Validations** | the **rules list** (declarative). See below. | |
| 112 | +| **Relationships** | lookup / master-detail fields + reverse relationships (list / graph). Relationships are created by adding a `lookup` field type. | |
| 113 | +| **Actions / Hooks / Views / Forms / Permissions** | the object's scoped instances, opened in-context. | |
| 114 | + |
| 115 | +### Right inspector (per-item config — the existing panels) |
| 116 | +Selecting an item in the main zone opens its existing config panel in the inspector, |
| 117 | +non-blocking: |
| 118 | +- a column / field → the **field editor** (type, options, required/unique, field-level validation) |
| 119 | +- a validation rule → the **rule editor** (condition builder + message + severity + events) |
| 120 | +- a record → record detail |
| 121 | +- an action → action config |
| 122 | + |
| 123 | +### Validation (grounded in the schema) |
| 124 | +`ObjectSchema.validations` is an array of `ValidationRuleSchema` — a discriminated |
| 125 | +union of six declarative rule types (`packages/spec/src/data/validation.zod.ts`): |
| 126 | +`script` (CEL predicate → fails when true), `cross_field`, `format`, |
| 127 | +`state_machine`, `json`, `conditional`. Each carries `message`, `severity` |
| 128 | +(error/warning/info), and `events` (insert/update/delete). |
| 129 | + |
| 130 | +- **Field-level** (required / unique / format) → configured in the **field editor** |
| 131 | + (they belong to the field). |
| 132 | +- **Cross-field / business rules** → the **Validations tab** → a declarative rules |
| 133 | + list; each rule edits in the inspector via a **condition builder** (field / |
| 134 | + operator / value, and/or) with a raw-expression escape hatch — never hand-written |
| 135 | + CEL as the primary path. Validation stays **declarative** (not a hook); Data-owned. |
| 136 | + |
| 137 | +### v1 scope |
| 138 | +- **Ship**: owned objects · `Records` grid · `Fields` manager · field editor (incl. |
| 139 | + field-level validation) · `Validations` (condition builder) · object `Settings` |
| 140 | + (label / icon / name field / compact / search). Relationships via the `lookup` |
| 141 | + field type. |
| 142 | +- **Defer**: Extended objects (objectExtensions) · External objects (datasources) · |
| 143 | + the ERD / model view · formal `Lifecycle` (v1 status = a select field) · `Indexes` · |
| 144 | + seed-data UI · saved views / kanban / calendar (presentation → Interface). |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## 4. Other pillars (to design — same shell) |
| 149 | + |
| 150 | +- **Automation** — left: automations grouped by trigger (record-change / scheduled / |
| 151 | + API / manual action); main: the flow **canvas**; inspector: the selected node's |
| 152 | + config; a Runs view for execution history. |
| 153 | +- **Interface** — left: surfaces (Apps · Pages · Views · Dashboards · Reports); |
| 154 | + main: the page **builder** (structured canvas) or **source + preview** (html/react |
| 155 | + pages); inspector: component props. |
| 156 | +- **Access** — left: roles; main: the permission **matrix** (objects × CRUD + record |
| 157 | + scope); inspector: role / field-level detail. |
| 158 | +- **Settings** (⚙) — General (app basic info) and Advanced (Code: hooks · functions; |
| 159 | + Connections: datasources), grouped by audience. |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## Mockups |
| 164 | +Interactive layout mockups were produced during the design session (grid + inspector, |
| 165 | +field manager, validation rule builder, object facet tabs). The ASCII sketches above |
| 166 | +capture their structure. |
0 commit comments