Designing an app · Lesson 2
Pages show data, agents read and write it, triggers react to it: almost every rule of an app is a rule about data. Two decisions carry most of the weight: who owns a collection’s records (ownedBy), and which other roles reach them (access). Here you see their effect on six people, one cell at a time.
Use Next, or the ← → keys. You can also change ownedBy and the lawyers’ rule yourself: the matrix is recomputed with the runtime’s own rule, and the validator checks the result.
Each collection declares its fields. The type decides the input on the form, how the value is checked and normalised, and how it is shown.
text, textarea, number, boolean, date — the basics; number fields can carry a unit price in billing.email, url, urls — checked on input; an email field is what where and derived roles compare.select, multiselect — fixed options, or optionsFrom: collection:<name> (the options are records); dependsOn filters them by another field.relation — a link to a record of another collection.object, array, json — structured values, with sub-fields for object and array.country, city, location — places; location is a position “lat,lng”, taken from the GPS on phones.file — uploads (pdf, docx, xlsx, csv, images…); extract: text gives the agent the text, capture takes a photo.barcode — a code read with the camera, or typed.On any field: required, default, help, visibleWhen (shown only if another field has a value), roles (only some roles see it — like the assigned lawyer above, which only the owner sets), gatedBy (unlocked by a plan).
parent — records that live under a parent record: the people of a family tree, the rooms of a building.sharing — per-record invitations as viewer or editor, decided by the record’s owner.searchable — the collection can be searched in full text, by people and by agents.retentionDays — records older than this are deleted automatically: keep only what you need.A role can be derived from a record: assignedBy: derived, from: collection:practices.manager_email. Whoever’s email is in that field holds the role, for as long as it stays there. Combined with where, it gives each practice manager their own practice, without anyone handing out roles by hand.
users, login_tokens, sessions, credentials, runs, approvals, files and a few others are the runtime’s own data. A manifest can never declare, show or give a tool over them: reading login_tokens would be an account takeover.
Lesson 3 is about the pages: how tables, cards, KPIs and charts show these records, and how a landing page is made of blocks.