Smithable websitedocsGitHubTry it
Menu

smithable.yml — spec version 0.1

smithable.yml describes what an application does, in technology-neutral terms. This page is the complete reference for version 0.1, together with its companions smithable.auth.yml (required) and smithable.content.yml (optional), and smithable.ux.yml (optional). Later versions add more.

Check a spec with smithable validate. For autocomplete and checking in your editor (VS Code with the YAML extension, or any editor using yaml-language-server), start the file with:

# yaml-language-server: $schema=https://docs.smithable.ai/schema/smithable-0.1.json

The companion files have schemas of their own: smithable-auth-0.1.json, smithable-ux-0.1.json, smithable-content-0.1.json and smithable-context-0.1.json, each started the same way. They say what may stand where; smithable validate is the judge of the rules between the files.

The JSON Schema covers smithable.yml; the companions are checked by smithable validate. The files are changed through operations, not by hand: the operations reference lists every one, generated from Smithable itself.

Example

smithable: 0.1

app:
  name: Acme CRM
  description: Lightweight CRM for a small B2B sales team.
  currency: EUR
  timezone: Europe/Mariehamn

models:
  Customer:
    description: A company we have a commercial relationship with.
    fields:
      name: string!
      email: email unique
      segment: smb | enterprise | government
      creditLimit:
        type: money
        min: 0

pages:
  customers:
    intent: Find a customer quickly and keep their details current.
    crud: Customer

navigation: [customers]

Top level

Key Required Meaning
smithable yes The format version: 0.1. Always the first key
app yes The application as a whole
models no The data the application stores
actions no Operations beyond create, edit and delete: custom ones in code, standard ones without
timers no What the app does on a clock: an event at a time, on a schedule or relative to a record's date, running an action
outgoing no What the app tells someone when something happens to a record or a timer comes: mail, or a signed call
incoming no Addresses where another service calls the app, and what a call does
queries no Records chosen or ordered by code, for what a filter cannot say
pages no The application's pages
navigation no Menus. Defaults to one menu with every page, in declaration order

app

Key Required Meaning
name yes The application's name
currency no ISO 4217 code of an active currency, e.g. EUR (a code no country uses is an error, with the nearest suggested). Used for money fields
timezone no IANA time zone, e.g. Europe/Mariehamn, or UTC; one the runtime does not know is refused with the nearest name. smithable new --timezone sets it; otherwise, where the starter or draft names none, new writes the machine's unless that is UTC, and an app with no pages gets none
clock no How times are written: 24h (the default) or 12h; smithable validate --explain says which
date no The order of a date's day and month: day-month ("5 Nov 2026", the default) or month-day ("Nov 5, 2026"). Dates are always written with the month's name, in the page's language (design/formats.md)
week no The first day of a calendar's week: monday (the default, with ISO week numbers) or sunday (no week numbers)
numbers no How numbers and amounts are written: point ("1,234.56", "12.5%", "€9.90") or comma ("1 234,56", "12,5 %", "9,90 €"). Unsaid, the language's: en is point, sv is comma. Form inputs read the app's decimal mark and ignore its grouping. setApp --numbers none goes back to the language's; --explain says which and why

Plus the semantic text keys.

models

Model names are PascalCase (Customer, InvoiceLine). Each model has fields (at least one) and may have semantic text.

Every model automatically has id, owner (the user who created the record, when users sign in), createdAt and updatedAt. These names cannot be declared, and no model may be called User: that is the people who sign in.

smithable validate warns when a field's name looks like data an app should not hold, or should hold only with great care: a payment card's number, security code or expiry (card-data: take payments through a payment provider and keep its reference), a password, key or token (secret-field: sign-in is the app's own, and keys for other services belong in the environment), a national identity or passport number (identity-number), and health or another specially protected kind of personal data (special-category-data). The warning goes by the name alone (a library card's number or a machine's health is not flagged), so whether it is right is yours to judge. smithable validate --json prints every finding with its code, file, line and column as one JSON document ({ valid, diagnostics }), for a program that acts on them. A finding may also have plain: { message, path }: wording for someone who does not read the spec, and the affected thing's path within its file (for a timer, ["timers", "markOverdue"]). The detailed message and text output stay unchanged; programs must allow findings without plain.

Key Meaning
fields The fields (below)
namedBy What names a record, its title wherever one record is shown or referred to (design/record-names.md): a field (namedBy: company: a text, a choice, a date, a number or an amount), a reference (namedBy: session: that record's own name), a field one reference away (classType.name), or a list of such parts joined with " · " ([classType, startsAt]: "Hatha · Mon 19 Oct, 08:00"), empty parts left out. A name that would come back to itself through references is refused. Left out, the title is picked by rule: the first short text field, else the first long text, else the record's number
ownedBy The field that owns the record instead of its creator, of three shapes (design/support-portal-path.md §2). A User field, e.g. ownedBy: accountManager: left empty on a new record, it is the creator. On a change the field keeps what is given, and left empty it stays empty: a record with no one in it is changed only by roles with write on the model, and neither a form nor an action takes it for whoever makes the change; setOwner without a field, or choosing someone, is the way. Only a role that may change everyone's records chooses whose a record is: anyone else makes their own, and the form leaves the field out for them. An email field, e.g. ownedBy: customerEmail: the record belongs to whoever has signed in with that address, proven (a code by mail proves it; a provider's account counts only when the provider says the address is verified). The address is stored lower-case and trimmed on every write and compared as stored; an empty address owns nothing, and no account is made from an address. A viewer who may not choose gets their own proven address written in, whatever the form sent, and is refused while their address is not proven ("Prove your address first"); a visitor's public form takes the address written. A reference to a model with an owner of either kind, e.g. ownedBy: supportCase on a message: owning through a reference is reading. The record is read by whoever may read the record it refers to, one step, never two (a chain, or a reference to a model without ownedBy, is an error); the record referred to must be one the viewer may read, and the reference is locked once the record exists. The record keeps its creator as the app's own owner column, so changing or deleting it, and the owner's standard actions on it, stay the creator's and the roles granted write or delete. The operation setOwner <model> [field] sets any of the three, and without a field returns the record to its creator
capacity At most so many records per referenced record, e.g. a booking's places (see Capacity)
schedule Its records are people (or rooms, chairs) whose time is booked: weekly hours, breaks, a gap, time away (see One person's time)
occupies Each record takes a scheduled record's time, e.g. an appointment its barber's (see One person's time)
trash true keeps deleted records in a trash for thirty days (see Trash)
review Holds the uploads of the fields it names until a reviewer approves them (see Review)
unique Fields unique together, e.g. [[customer, number]]: no two records hold the same values in all of them (see Unique values)
thread What a conversation reads from the records when a page shows a list of them as a thread: { body: content, author: sender, side: { field: direction, ours: out } }, each part optional; what is left out is read from the fields (record.lists)

Fields

Field names are camelCase (email, creditLimit); any word may be one, default and new too (an action's name may not be such a word, actions). A field is written in the short form or the long form.

Short form: <type>[!] [unique] [= default]

Example Meaning
name: string Optional text
name: string! Required text (! = required)
email: email unique No two records may have the same email
capacity: int! = 12 Required whole number, default 12
status: draft | sent | paid One of these values. The first value is the default

Long form, for anything more:

level:
  type: beginner | allLevels | advanced
  default: allLevels            # a default other than the first value
rating:
  type: int
  required: true
  min: 1
  max: 5
  default: 3
  description: Stars from one to five.
priority:
  type: low | high
  default: none                 # stays empty until someone chooses
Key Meaning
type A type, optionally with !, or choices (a | b | c)
required true or false (same as !); or a condition, required while the record fits it: required: { status: [inProgress, closed] }
by app: the form never shows the field; its value comes from its default, an action, an incoming entry, an import or code. For example agent: { type: User, by: app, default: ME() }
sequence true on an int! with no default: each new record gets the next number, counting up from the records' highest in the same transaction, and a number given once is never given again, not after a delete nor after a restore from the trash (an order or invoice number); the field is unique, among an owner's records where unique fields are, else in the app. Numbers may skip (a refused create keeps its number); a backup restored puts the count back where the backup had it. The form never shows it, as with by: app. For example number: { type: int!, sequence: true }
locked true: set when the record is made, never changed after; or a condition, read-only while the record fits it: locked: { status: closed }. The form shows it as fixed and the server refuses a change; an action's set may still change it, which is how a closed case is reopened
unique true or false; or where the value is unique: owner (among one owner's records) or app (in the whole app). true is per owner when the model's records are read by their owners only, else in the app; see Unique values
default A value of the field's type, or a formula like TODAY(), or ME() on a field that refers to User: who makes the record. For choices, none means no default
formula Makes the field computed: its value comes from a formula and is not entered
examples Inputs and expected results of the formula; each becomes a test
min, max Bounds for int, decimal and money; for string and text, the length in characters (by default at most 200 for string and 10,000 for text)

Plus the semantic text keys.

A condition in required or locked is written as an action's when: a choice field's value or a list of them, a yes/no field's true or false, or a computed text or yes/no field's value (a computed one worked out as the record is loaded). A locked condition is read on the record as it is before the change, so an edit that both closes a case and changes a locked field is refused; a required condition on the record as it would be after it, when it is made or changed, so choosing the status that needs a field without giving the field is refused. setFieldRules Order total --locked status=shipped sets it (--once for locked: true, --by app, --required status=placed, --sequence true for a number in turn; an empty one removes it). A field's default is set by setFieldDefault Order minutes 60 (a number for a number field, true or false for yes/no, a choice's value or none for no default at all, written as the default key on a choice; --remove takes it away), and its bounds by setFieldRange Order minutes --min 15 --max 240 (a text's shortest and longest length on a text field; --none takes both away).

Changing a choice field's values (changeField Order status "draft | placed | onItsWay | canceled" --renames shipped=onItsWay) says what the records and samples holding a value that goes get instead (shipped= leaves them empty); a value still held that the change does not mention is refused, with how many hold it. A renamed value is followed wherever the app names it: in conditions (where, when, a field's locked and required), in what an action sets, in formulas that compare with it and their examples, in a long-form default, in what visitors may read, and in its tone and text. Where a value that is simply gone is named, the change is refused with the place. A choice field with a default always has a value, so it counts as required. A choice field with default: none is optional unless required: true.

Types

Type Holds Default example
string Short text = Unnamed
text Long text
markdown Long text with formatting (headings, lists, links, emphasis, quotes), written as Markdown and shown formatted; raw HTML in it is shown as text
int Whole number = 60
decimal Number with decimals = 0.5
money Amount in the app's currency = 9.90
bool Yes or no = true
date Calendar date = 2026-09-01
datetime Date and time = 2026-09-01T09:30
email Email address
phone Phone number
url Web address = "https://smithable.ai"
picture A stored picture with its description (see Pictures); no default, never unique
pictures Up to ten stored pictures, the first the cover (see Pictures); no default, never unique
file A stored document: a PDF, an Office or OpenDocument file, a text, a CSV or a picture (see Documents); no default, never unique
files Up to ten stored documents, in order (see Documents); no default, never unique
a | b | c One of the listed values (camelCase) first value
Customer, Customer! A reference to one record of another model (see Relations)
Order[] The records of another model that refer to this one
User, User! One of the people who sign in (see smithable.auth.yml)

Relations

A field whose type is a model name refers to records of that model:

models:
  Customer:
    fields:
      name: string!
      orders: Order[]          # every order that refers to this customer
  Order:
    fields:
      number: string! unique
      customer: Customer!      # each order belongs to exactly one customer

Pictures

models:
  Instructor:
    fields:
      name: string!
      portrait: picture

Documents

A file field holds one document on a record, as picture holds one picture: a contract on an invoice, a CV on an application, a receipt on an expense. files holds up to ten, in order.

models:
  Invoice:
    fields:
      number: string! unique
      contract: file
      receipts: files

Formulas

Computed fields and defaults use spreadsheet-style formulas:

Order:
  fields:
    total: money!
    shippingMethod: standard | express
    shippingCost:
      type: money
      formula: IF(AND(shippingMethod = "standard", total > 100), 0, IF(shippingMethod = "express", 15, 5))
      examples:
        - input: { total: 150, shippingMethod: standard }
          expected: 0
Invoice:
  fields:
    issuedOn: date! = TODAY()
    dueOn:
      type: date!
      default: DATEADD(issuedOn, 30, "day")
    lines: InvoiceLine[]
    total:
      type: money
      formula: SUM(lines.amount)

Unique values

A field's unique says no two records hold the same value, and where (design/uniqueness.md):

    fields:
      email: email unique                      # the short form: where, as the access says
      reference: { type: string, unique: owner } # among one owner's records
      code: { type: string, unique: app }        # in the whole app
    unique: [[customer, number]]                 # the two together, where as the access says

Trash

trash: true on a model keeps its deleted records in a trash for thirty days, where whoever may delete them can restore them or remove them for good; the rest of the app does not see them (design/trash.md). A unique value holds among the live records only, so a value a trashed record has can be used again, and restoring that record is then refused with the same words a new record gets; a record other records point to with a required reference goes to the trash together with them when their models have a trash too, after a dialog with the facts, and comes back with them; otherwise it cannot be trashed, and the refusal says what uses it (design/delete-together.md). The outgoing deleted event fires when the record is trashed. The operation setTrash <Model> true|false turns it on or off; off removes what is in the trash for good and asks first.

models:
  Customer:
    trash: true
    fields: { name: string!, email: email }

Review

review on a model holds the uploads of the picture, pictures, file and files fields it names (or all of them) until a reviewer approves them (design/file-review.md). A reviewed field that is required holds the whole record: until its file is approved, the record is out of lists, search, dashboards, calendars, the API and the assistant's tools for everyone but its owner and the reviewers, and its owner sees it marked as awaiting review. An optional one holds only the file: the record shows as usual, and to others the picture is a blank awaiting review and the document is not offered. A new upload, and one replacing a file, starts waiting; a rejected one is removed and the reason is shown to the owner. A name that is no picture or file field is an error (review-not-file); all on a model without one is a warning (review-nothing), and so are files with no review page to wait on (review-no-page). Reviewers are the admins and the roles granted review in smithable.auth.yml; they are told by mail, each at most every fifteen minutes, how many files wait, and the review page's menu entry shows the number. Files a reviewer sends, sample data and files from before review was turned on are not held. The operation setReview <Model> <fields…|all|none> sets it.

models:
  Listing:
    fields: { title: string!, photo: picture!, contract: file }
    review: [photo]                      # or all; photo is required, so a listing waits for it

pages

Page names are camelCase or kebab-case (customers, my-bookings). Each page uses one pattern:

Key Required Meaning
crud, landing, dashboard, settings, onboarding, users, data, calendar, articles, calculator, legal, review or custom one of them The pattern (see below)
sections no Parts of the page beside its kind's own, in order (a text, a FAQ, a model's records); alone, with no kind, a page of parts
route no Defaults to / plus the page name in kebab-case (classTypes → /class-types). /health, /sign-in and /api/… are reserved
actions no Crud pages: actions offered as buttons, e.g. [mergeCustomers]
filters no The days of a date filter are those of the viewer's own zone when they have chosen one, else the app's. A crud page's may go one reference away, session.startsAt: a date, choice, reference, number or yes/no field of the record the reference names (not two steps, not a list, not a person), in the address as ?session.startsAt=today, and defaultFilter may name it. Crud and calendar pages (on a calendar only choices, references, people and yes/no fields: its days are the range; drawn over it as on a list, the ux file's filters look applying): fields the list can be filtered by, e.g. [category, price, available]: a choice or a reference becomes chips (a select when there are more than eight values; a reference whose records the viewer may read number 200 or more, a field that finds them as you type, see filters.pick in the ux file), a number, amount or date a range with "from" and "to", yes/no a toggle. Free text is searched, not filtered; pictures never; a field that refers to a person (assignee: User) gives chips for Mine, Unassigned and the people by name (a select when there are more than eight), in the address as ?assignee=me, none or a person; owner gives signed-in viewers a "Mine" toggle. The state lives in the address (?category=furniture&price=100..500), so a filtered view can be linked; the query applies filters, search and sort together, within what the viewer may read. A date or date-time filter also takes a relative value, upcoming (from this moment; for a date without a time, from today), past (before that), today, thisWeek (from Monday) or thisMonth, resolved when the query runs in the app's time zone and kept in the address as written (?startsAt=upcoming). On phones the filters fold behind a "Filters" button; smithable.ux.yml may name the filters shown first on every screen
defaultFilter no Crud pages: filter values applied when the address says nothing, by filter, e.g. { startsAt: upcoming } so a list of sessions opens on what is to come, or { status: [open, pending] }; each must be among the page's filters and a value its filter takes (a date a relative value or a range, a number a range, a choice its values, yes/no true or false, owner mine, a person me or none; a reference to another record takes none). It shows as a chip the viewer can take away; the address then says ?startsAt=all, which clears it. setDefaultFilter sessions startsAt upcoming sets one, setDefaultFilter sessions startsAt none removes it
sortable no Crud pages: fields the visitor may sort the list by, either way, from a "Sort by" control, e.g. [price, createdAt]; smithable.ux.yml's table.sort stays the order until someone chooses. Not pictures, long text, lists of records or calculated fields (the query sorts by a stored column)
mine no Crud pages: true makes the page list only the viewer's own records (my items, my orders), with the same form to add one; it needs sign-in, so it never belongs under public.pages. The list's query keeps only the viewer's records, whatever the address says, and filters: [owner] gives no Mine toggle there
period no Dashboards: a date field every tile's model has, or a field per model (period: { Invoice: issuedOn, Payment: paidOn }). The page then has period chips (thisWeek, thisMonth, lastMonth, thisYear, a range), in the address as ?period=lastMonth, in the viewer's own zone or the app's. Each count, sum, average, list and by chart is scoped to it; a when list, activity and a custom query ignore it. A by chart then shows only the bars inside. Unsaid, all time.
export no Crud pages: false takes away the list's Export CSV, for records an owner wants kept in the app (the API's CSV, for a key, stays). Unsaid, a list offers it: the list as filtered and sorted, within what the viewer may read, named <page>-<date>.csv, times ISO in the app's zone with their offset, amounts as plain decimals.
favorites no Crud pages: true gives each record a heart and the list a "Saved" view of the viewer's own marks (a visitor who clicks is asked to sign in; nothing is shown to others); only makes the page a list of the viewer's saved records. Each mark is the person's own (a table of its own, one row per person and record, gone with either); marking checks that the viewer may read the record. Needs sign-in: without it, nothing is generated
contact no Crud pages: a "Contact" block on the record page that mails the record's owner (contact: owner) or the user a field of the model names (contact: seller), with the record's title and link; the sender's address is the reply-to, the recipient's is never shown; nothing is stored unless { to: owner, keep: Message } names a model of its own to keep a copy in. That model may have one reference to the page's own model (an Enquiry with project: Project on a projects page), which the server fills with the record the block is on, never from the request (smithable validate --explain names it); any other reference is refused, since visitors would pick among records. Its other plain fields (not by: app) are asked in the block's form, with the landing contact form's fields; a model that asks more than a message still has name, email and message, filled with the sender's. The block's texts are pages.<page>.contact: { title, text, button, thanks } in smithable.content.yml, the kit's words where unsaid. Visitors may send on a public page, otherwise signed-in viewers (a signed-in sender's name and email are filled in and locked); limited like other writes; refused when the recipient cannot be reached
document no Crud pages: the record as a document (an invoice, a quote, a receipt), printed or saved as PDF from its page at /<page>/<id>/document, read with the viewer's own rights (design/record-documents.md §4). Each block names its fields, and nothing else is printed: show (required) the record's, to: { ref, show } those of a record it refers to, lines: { list, show } a list field's records as a table, totals the record's fields under it, note one text field, and from the settings page's fields (refused without a settings page). A file, a list or a field that looks like a card number, a password or an identity number is refused, and so is a worked-out field read from one. One per model. Its headings and the Print button's words are under pages.<page>.document in smithable.content.yml (title, from, to, lines, totals, note, print)
search no Crud pages: fields the list can be searched by, e.g. [name, email]: a search box finds records containing the text in any of them, ignoring case. Text, email, phone, web address and choice fields, and references ([number, customer] finds orders by their customer's name)

Plus the semantic text keys. Visible text such as titles does not belong here; it goes in smithable.content.yml.

Sections

Any page is a list of named sections (docs/design/page-sections.md): its kind's own part first (a crud page's list, a dashboard's tiles, a calendar), and the sections written beside it. A page may also have sections alone, with no kind: a page of parts, in the app's frame unless the ux file says otherwise.

pages:
  about:                                  # a page of parts, no kind
    sections:
      story: { text: }                    # a heading and paragraphs, from the content file
      team: { records: Instructor }       # a model's records as cards, as on a landing page
      faq:                                # a section named after its kind
      visit: { contact: }                 # a kind as an option gives the section any name
  sessions:
    crud: Session                         # the page's kind: its list and record pages
    sections:                             # more parts around it
      notice: { text: }
      crud:                               # where the page's own list sits (first, when not named)
      faq:
  planning:
    sections:
      week: { records: Session, view: calendar, starts: startsAt }   # a calendar on a page of parts

Landing pages

pages:
  home:
    route: /
    landing:
      hero: { button: sessions, secondButton: pricing, shortcuts: [sessions, blog] }   # its buttons' pages; up to four shortcuts
      classes: { records: ClassType }     # a model's records as cards (limit: 6 by default)
      latest: { records: Item, search: true, filters: [category, price], limit: 8 }   # a catalog's door: the box and chips lead to the model's list page
      open: { records: Incident, where: { status: [investigating, identified] } }   # only the records these values fit
      features:
      pricing:
      testimonials:
      faq:
      callToAction: { button: sessions }
      gallery:                            # pictures that open large
      contact: { form: Message }          # details, and a form visitors send
      footer:                             # the page's own footer, wherever it is listed

Dashboards

pages:
  overview:
    dashboard:
      outstanding: { sum: Invoice.total, where: { status: sent } }   # a number
      open: { count: Invoice, where: { status: sent } }
      average: { average: Invoice.total }
      invoiced: { sum: Invoice.total, by: issuedOn }                   # by month: a bar chart
      weekly: { count: Invoice, by: issuedOn, period: week }           # the last eight weeks
      byStatus: { count: Invoice, by: status }                         # a bar per value of a choice
      bySegment: { sum: Invoice.total, by: customer.segment }          # a choice one reference away
      latest: { list: Invoice, limit: 5 }                              # the newest records
      due: { list: Invoice, when: dueOn, within: 2 weeks }             # what is due, the overdue first
      recent: { activity: changes, limit: 8 }                          # the app's latest changes

Settings and onboarding

pages:
  settings:
    settings: BusinessProfile            # the viewer's business details
  welcome:
    onboarding:
      model: BusinessProfile
      steps:                             # in order; each asks for some fields
        business: [businessName, vatNumber]
        payment: [iban, paymentTermDays]

Users

pages:
  team:
    users: manage                        # invite people, change roles, remove users
                                         # for administrators; a role gets it by naming it in its "pages" (smithable.auth.yml)

Calendars

pages:
  schedule:
    calendar: Session                    # short form: the model's one date or date-time field places records
    # calendar: { model: Session, starts: startsAt, duration: classType.durationMinutes, title: classType }

Orders

pages:
  menu:
    route: /
    order:
      from: Dish                               # what is chosen: one money field is its price
      into: Order                              # one record per order, with its one list of lines
      ask: [name, phone, wanted, note]         # the order's fields the customer fills, in order
      hours: { mon-thu: "11:00-20:00", fri-sat: "11:00-22:00" }
      lead: 20                                 # minutes from now to the earliest wanted time

Calculators

pages:
  mortgage:
    calculator:
      fields:
        price:   { type: money, min: 0, default: 300000 }
        deposit: { type: money, min: 0, default: 60000 }
        years:   { type: int, min: 5, max: 40, default: 25 }
        rate:    { type: decimal, min: 0, max: 20, default: 4.5 }
        monthly: { type: money, formula: "PMT(rate / 100 / 12, years * 12, price - deposit)" }
        total:   { type: money, formula: monthly * years * 12 }
      examples:
        - input: { price: 300000, deposit: 60000, years: 25, rate: 4.5 }
          expected: { monthly: 1334, total: 400200 }

Privacy page

legal: privacy is a privacy page written from the app itself (design/legal-page.md): who runs it, what it stores about people and why (every model with an email, phone or user field, with who may read it), uploads, cookies and the analytics setting, mail, logs and backups, and a person's rights. The facts come from the spec, the auth file and the context file, so the page stays true as the app changes; the operator's details are texts in smithable.content.yml under the page's operator (name, address, email, country, hosting), and a more part holds the maker's own words after the generated text. Three more keys hold what only the maker knows (legal-page.md §6.2): keeps, how long each kind of record is kept, in the maker's words, by the model's name (a model named there is listed even when its fields hold nothing personal, and one with no line is said to be kept until removed or asked for; a name that is no model is a warning, privacy-keeps-unknown); services, other services the operator uses that the files do not show, a list of { name, for, where }; and custom, what the owner's own functions (custom code and custom actions) do with people's details. The owner reviews the page's description of the app with reviewPrivacyPage <page> <facts> <day> (Studio supplies the facts' fingerprint and the day), which writes reviewed: { facts, on } under the page; while the facts are the ones reviewed the page says so with the day, and once they change smithable validate warns privacy-unreviewed (legal-page.md §6.4). validate also warns privacy-missing (no privacy page where people sign in, fill in a public form, send mail in, ask the assistant as visitors or are counted by analytics), privacy-custom (custom code and no custom text) and operator-unknown when the contact email is missing. smithable validate warns while the operator's name is missing. The page is public and linked from the site's footer and the consent bar, never a menu entry; addPrivacyPage [page] [route] adds it at /privacy, one per app.

pages:
  privacy:
    route: /privacy
    legal: privacy

Pages and sections of your own

pages:
  planner:
    custom: Planner                        # src/custom/pages/Planner.tsx, created once
  home:
    landing:
      hero:
      repayment: { custom: RepaymentChart } # src/custom/sections/RepaymentChart.tsx, created once

Articles

pages:
  blog:
    articles: Post                       # short form: its parts are inferred
    # articles: { model: Post, title: title, body: body, picture: cover, date: publishedOn, address: address, summary: summary, author: author }
  posts: { crud: Post }                # where staff write them: a page the roles' grants name

Data

pages:
  admin:
    data: all                            # every model; or a list, e.g. data: [Customer, Order]
                                         # for administrators; a role gets it by naming it in its "pages" (smithable.auth.yml)

Review

pages:
  review:
    review: all                          # every model with review; or a list, e.g. review: [Listing]

actions

An action is something the application does beyond create, edit and delete. A custom action declares what it takes and returns, and its behavior is code. A standard action sets fields of one record and needs no code (below).

An action's name is camelCase like a field's, and is refused when it is a word the code reserves (return, delete, new, …) or a model's name with a small first letter (checkIn beside a model CheckIn): the refusal names one that fits, the action's name with its model's (returnTool, checkInHabit).

actions:
  mergeCustomers:
    custom: true
    input: { keep: Customer!, duplicate: Customer! }
    output: { moved: int! }                  # optional
    intent: Merge a duplicate customer record into the one we keep.
    rules:
      - All orders of the duplicate move to the kept customer.
    touches: { reads: [Customer, Order], writes: [Order.customer, Customer] }   # optional: what the code reaches
    triggers: [customerMerged]               # optional: the outgoing entries the code may fire
    examples:                                # optional: tests of the code, run by the app
      - given: { Customer: [{ id: 1, name: Arctic Outdoor Co }, { id: 2, name: Arctic Outdoor }], Order: [{ id: 1, customer: 2 }] }
        input: { keep: 1, duplicate: 2 }
        after: { Order: [{ id: 1, customer: 1 }] }
        output: { moved: 1 }

Standard actions

A standard action is a button that moves a record to its next state: resolve an incident, mark an invoice paid, cancel a booking. It names the model, when it applies, and the new values. Buttons that change a record walks through each kind on the invoicing starter.

actions:
  resolve:
    on: Incident                                              # the record it changes
    when: { status: [investigating, identified, monitoring] }  # optional: offered and allowed only then
    set: { status: resolved, resolvedAt: NOW() }              # the new values
  markPaid:
    on: Invoice
    when: { status: sent }
    set: { status: paid, paidOn: TODAY() }

timers

What the app does on a clock (design/timed-actions.md): a timer is an event the app raises itself at a time, on a schedule or relative to a date-time of a record, and may run an action over the records the time has come for. Mail and calls stay outgoing's, whose when names a timer as it names an action. The spec holds the timer because what the app does on a clock is what the app does: versioned, generated, shown in What it does, undoable.

timers:
  remind:
    on: Booking                             # the records it runs for
    at: 1 day before session.startsAt       # a date-time of the record, or one reference away, with an offset
    where: { status: confirmed }            # optional: only records that fit
                                            # no run: the timer only raises its event; outgoing listens
  markOverdue:
    on: Invoice
    at: 7 days after dueOn
    where: { status: sent }
    run: markOverdue                        # a standard action of Invoice; a record its when does not fit is skipped
  publish:
    on: Post
    at: publishAt                           # as it is: when the time comes
    run: publish
  weeklyDigest:
    every: monday                           # day | weekday | week | month | monday … sunday
    at: "08:00"                             # a clock time, in the app's time zone
    run: sendDigest                         # a custom action, once
  payroll:
    cron: "0 6 25 * *"                      # what every cannot say: five fields, the app's time zone
    run: closePayroll

outgoing:
  reminder:
    when: remind                            # a timer's name, as an action's
    to: mail
    recipient: owner

Merging records

A merge is an action that makes two or more records of a model one (design/intents.md §3):

actions:
  mergeCustomers:
    merge: Customer                  # two or more customers become one; the person picks which stays
    fields:                          # what each field does; a field not named is asked when the records differ
      email: ask                     # the person picks one of the values
      segment: keep                  # the kept record's value (the first other's when the kept is empty)
      revenue: add                   # numbers and amounts: the sum
      notes: append                  # texts: the kept's, then each other's, a blank line between
  combineLines:
    merge: Line
    into: new                        # a new record is made from the picked ones, which stay as they are
    fields: { quantity: add }

Splitting a record

A split is an action that makes one record of a model two (design/intents.md §4):

actions:
  splitOrder:
    split: Order                     # one order becomes two
    move: lines                      # the list whose picked records go to the new order
    copy: [customer, deliverTo]      # the fields the new order takes from the old; unsaid: every stored field but the unique, the sequences, the app's, the pictures, the documents and the lists

outgoing

Something happens to a record and the app tells someone. An entry names what happens, whom to tell and how: by the built-in channels, mail, browser push and text messages (design/notifications.md), or by a signed call to a named target (design/integrations.md §4).

outgoing:
  bookingMade:
    when: Booking created            # <Model> created | changed | deleted, or an action's name
    to: mail
    recipient: owner                 # the record's owner; a role (admin); or an address on the record
  bookingConfirmed:
    when: Booking changed
    where: { status: confirmed }     # optional: only records that fit
    to: mail
    recipient: customer.email        # an email field, or a field that refers to User, one reference away at most
    show: [number, wanted, total]    # optional: the fields the mail lists under its text (a call's record carries), in this order; none for the text alone
    previous: true                   # optional, for "<Model> changed": what the changed fields were, too
  sessionMoved:
    when: Session changed
    fields: [startsAt]               # optional: only a change of these fields counts
    to: mail
    recipient: bookings.owner        # a list field, then the owner or an address of each of its records
  orderPlaced:
    when: Order created
    to: [mail, push]                 # a channel, or a list of channels that each reach the recipient
    recipient: staff
  orderReadyText:
    when: ready
    to: sms
    recipient: phone                 # a phone field of the record
  todaysBookings:
    when: morning                    # a clock timer with no records: a list mail
    to: mail
    recipient: admin                 # a role that reads every record of the list's model
    list: { model: Booking, when: session.startsAt, within: today, columns: [session, attendee, status] }
    empty: skip                      # optional: skip (unsaid; nothing to send, no mail) or send (a mail that says so)

payments

A record paid for on a payment provider's own page (design/payments.md): the app sends the payer there and records the payment when the provider's verified word comes, never on the payer's return. The app never touches card data. The section says what is paid, how much, when and what a payment changes; the provider is named in smithable.context.yml (below), the only file that names a technology.

app: { name: Kiosk, currency: EUR }   # payments need the app's currency

payments:
  orderPayment:
    on: Order                          # the model whose record is paid for; one entry per model
    amount: total                      # a money field of the record, stored or computed
    when: created                      # pay to create: the record is held until paid
    paid: { set: { paid: true } }      # optional: what a successful payment sets on the record
    refund: { by: [admin], when: { status: declined } }   # optional: who may refund, and on which records
    description: "Order {number}"      # optional: what the payer sees on the provider's page
  invoicePayment:
    on: Invoice
    amount: total
    when: { status: [sent, overdue] }  # Pay is offered on the records that fit
    paid: { set: { status: paid } }

outgoing:
  receipt:
    when: orderPayment                 # a payment of the entry succeeded, on the paid record
    to: mail
    recipient: customer.email

incoming

Another service calls the app: a monitor that finds a site down, a form service, a payment provider. An entry names an address of the app, /incoming/<name>, and what a call does (design/integrations.md §3).

incoming:
  monitorDown:
    create: Incident                 # one record per call
    set:
      title: "{check.name} is not responding"   # {path}: a value from the call's JSON
      status: investigating
      detectedAt: NOW()
    id: "{event.id}"                 # optional: a call seen in the last day is not acted on again
    as: staff                        # the role the call acts as (admin when not said)
  paymentReceived:
    custom: true                     # src/custom/incoming/payment-received.ts decides
    signed: sha256                   # a signature of the body, not the secret itself
  chatCommand:                       # a chat tool's slash command opens an incident
    create: Incident
    set: { title: "{text}", status: investigating, detectedAt: NOW() }
    body: form                       # the command comes form-encoded, not as JSON
    signed: { sha256: "v0:{timestamp}:{body}", prefix: "v0=", timestamp: X-Slack-Request-Timestamp }
    header: X-Slack-Signature
    challenge: challenge             # the tool's setup check: answered with the value, nothing else
    as: staff
incoming:
  support:
    mail: true
    create: Request
    set: { status: new }
    fields: { from: email, subject: title, body: body, attachments: files }
    reply:                           # a mail of one of its requests' threads
      create: Message                # refers to Request once (Message.request)
      fields: { from: from, body: body, attachments: files }
      set: { direction: in }
      then: { status: open }         # on the request it joins: a reply reopens it

queries

A query is records chosen or ordered by code, for what a filter cannot say:

queries:
  churnRisk:
    custom: true
    returns: Customer[]
    intent: Customers most likely to stop buying, most at risk first.
    rules:
      - A customer without an order in 90 days is at risk.

Sections Smithable does not know: project plugins

A top-level key that no built-in section or plugin handles is an error, never ignored. smithable teach <key> has a model write a project plugin for it once: smithable/plugins/<key>/plugin.mjs, declared in smithable.context.yml (plugins: [newsletter]). After that, the section is handled without AI:

newsletter:                      # handled by smithable/plugins/newsletter/plugin.mjs
  from: hello@stillwater.ax
  lists: [classes, offers]

A plugin is one ES module without imports, exporting { key, description, schema, expand?, patch?, generate?, operations?, summarize? }, or a function of the plugin API (OperationError, didYouMean, identifier, kebab, refTo) returning it:

Capacity

models:
  Session:
    fields: { startsAt: datetime!, capacity: int! = 12, bookings: Booking[] }
  Booking:
    fields:
      session: Session! unique           # with private access: one booking per member and session
      status: confirmed | canceled
    capacity:
      per: session
      max: session.capacity
      where: { status: confirmed }
      closes: 2 hours before session.startsAt     # optional: booking until then (the start itself, written as the field)
      cancelUntil: 24 hours before session.startsAt   # optional: the owner cancels until then; staff always may

One person's time

models:
  Service:
    fields: { name: string!, minutes: int!, price: money }
  Barber:
    fields: { name: string!, phone: phone }
    schedule:
      hours: { mon-fri: "09:00-17:00", sat: "10:00-14:00" }
      breaks: "12:00-12:30"
      gap: 10                          # minutes kept free after each appointment
      away: TimeOff                    # records of days or hours away
  TimeOff:
    fields: { barber: Barber!, from: datetime!, until: datetime!, note: string }
  Appointment:
    fields:
      service: Service!
      barber: Barber!
      startsAt: datetime!
      status: requested | confirmed | cancelled
    occupies:
      resource: barber
      starts: startsAt
      duration: service.minutes
      while: { status: [requested, confirmed] }
      cancelUntil: 12h

A class takes places on a session (Capacity); a barber, a physiotherapist or a court is booked by its time: one appointment at a time, inside its hours.

Access

Who may do what is said in smithable.auth.yml, in full; smithable.yml names no role (design/access-in-auth.md). Three rules, and nothing implied beyond them:

  1. The record rule is defaultAccess: with shared everyone who signs in reads every record, with private only their own. Everyone changes and deletes their own records.
  2. A role does what its block grants, shaped like public: the pages it opens, the models it adds records to (create), reads everyone's records of (read, with private), changes (write) or deletes (delete) everyone's records of, and the custom actions it runs (actions). Each is a list of names, or all. A role with no block has the record rule and nothing more; smithable validate warns when a role can open no page.
  3. Administrators do everything: admin: all, written in the file; anything else under admin is an error.
shared (internal tools, teams) private (SaaS, consumer apps)
Read Everyone who signs in The owner, and roles granted read
Create Roles granted create Roles granted create
Change and delete The owner, and roles granted write or delete The owner, and roles granted write or delete
Open a page Roles whose pages name it (public pages: anyone) The same
Run a standard action The owner and roles granted write on its model, unless their actions grant is none, and roles whose actions name it The same
Run a custom action Roles whose actions name it The same
Everything Admins Admins
roles:
  admin: all
  sales:
    description: Works with customers and orders.
    pages: all                   # every page but the administrators' (the users page, a data page), which a role gets by naming them;
                                 # on the users page it then invites and gives only roles within its own rights (see Users)
    create: all
    write: [Customer, Order]     # anyone's customers and orders; deleting them stays each one's own, and admins'
    actions: [mergeCustomers]    # custom or standard; a standard one also follows "write" on its model

Either a list of pages (the main menu), or named menus:

navigation: [customers, orders]

navigation:
  main: [customers, orders]
  admin: [settings]

The operation setNavigation <menu> <pages…> sets which pages a menu shows, in order. The list replaces the menu, so it names every page that stays.

Semantic text

Any app, model, field or page may carry free text that explains meaning to AI and developers. It is never shown to visitors.

Key Meaning
description What it is. On a choice field, a short one (120 characters at most) is also in the assistant's summary line, so a model reads the app's words for the values before it filters on one
intent The outcome or experience it should achieve
rules Domain rules as sentences. A rule does nothing by itself until something implements it; implemented rules get an id: { id: capacity, rule: … }

The operation setMeaning <concept> <description> gives the app, a model, a field (Model.field), an action, a page or a query (query:<name> when a page or an action has its name) its description (or, with --intent, its intent); setRuleId <concept> <number> <id> gives a rule its id, so code and tests can say they implement it. addRule <concept> <rule> [--id name] writes one (on app, model:Order, field:Order.total, action:…, query:… or page:…; a field gets its long form) and removeRule <concept> <number> takes one away, asking first when it has an id.

smithable.content.yml: visible text

Optional, next to smithable.yml. Every text a visitor sees is derived from names (creditLimit → "Credit limit", class-types → "Class types"). This file lists only what should read differently.

smithableContent: 0.1
language: en                     # the language of everything a person reads; en is the default
logo: { src: images/logo.webp, alt: A lotus on still water }   # the app's mark
initials: SY                                                   # the tile's letters (by rule when unsaid)

models:
  Customer:
    label: Client                # singular; the plural defaults to "Clients"
    pluralLabel: Clients
    fields:
      creditLimit:
        label: Credit limit (EUR)
        help: Orders are held above this amount.   # shown under the form field
      segment:
        values: { smb: Small business }            # text for a choice value
  Booking:                                         # a model with a capacity: the reservation block's words
    reserve: { book: Reserve a mat, cancel: Give up my mat, full: No mats left, booked: You have a mat }
pages:
  customers:
    title: Our clients                             # page heading and menu entry
    subtitle: Keep every relationship in view.     # a line under the heading
    description: Every client of Acme, with their orders.  # what search engines show (public pages)
menus:
  admin: { label: Administration }                 # heading of a named menu
actions:
  resolve: { label: Mark as resolved, help: Closes the incident and tells the subscribers. } # label: its button and page title, else its name in words; help: the button's tooltip and a line under its dialog's title (the intent, in smithable.yml, is never shown)
  markSent: { confirm: "Send invoice {number} to {client.email}?" } # the question of an action with confirm: true (Standard actions, Asking first)
outgoing:
  bookingMade: { subject: "Your booking #{number}", text: "Thank you, {customer}! See you on {wanted}." }  # an outgoing entry's mail; {path} is filled from the record (see outgoing)
assistant:                                         # Ask, the assistant in the app: its texts
  name: Nova                                       # the panel's name ("Ask" by default)
  greeting: Ask me about your customers and orders.  # the first line it shows
  placeholder: How many orders are open?           # the question box's placeholder
  about: Finds and counts customers and orders.    # what it is for: shown, and given to the model

assistant holds Ask's visible texts, in the app's language; who gets it is smithable.auth.yml's assistant, its voice smithable.ux.yml's. setAssistantTexts --name Nova --greeting "…" sets them, and an empty one (--name "") clears it, so the kit's words come back.

A landing page's sections and a dashboard's tiles have their texts under the page, by name:

pages:
  home:
    hero: { title: Find your calm, subtitle: Small classes for every level., button: See the schedule, secondButton: Our prices }
    classes: { title: Our classes, text: A little time, just for you. }
    features:
      title: Why Stillwater
      items:
        - { title: Small groups, text: Never more than twelve. }
    pricing:
      items:
        - { name: Drop-in, price: €15, period: per class, features: [Any class], button: Book }
    testimonials:
      items:
        - { quote: My favorite hour of the week., name: Aino, role: Member }
    faq:
      items:
        - { question: Do I need experience?, answer: No. }
    callToAction: { title: Your first class is waiting, text: …, button: Book a class }
  overview:
    outstanding: { label: Outstanding }

The new sections' texts:

    contact:
      title: Questions? Write to us
      address: |                          # one line per line; "Show on map" opens OpenStreetMap
        Storagatan 1
        22100 Mariehamn
      phone: +358 18 123 456
      email: hello@stillwater.ax
      hours: |
        Monday to Friday 7–21
      button: Send message                # the form's button
      thanks: Thank you! We will get back to you within a day.
    gallery:
      title: Inside the studio
      items:
        - image: { src: images/gallery/studio.webp, alt: A yoga mat by a window }
          caption: Morning light in the studio
    footer:
      text: Stillwater Yoga · Storagatan 1, Mariehamn
      items:
        - { label: Class schedule, link: /sessions }             # a page's address,
        - { label: Email us, link: "mailto:hello@stillwater.ax" } # or https:, mailto:, tel:

A crud page's contact block (contact: owner) has its texts under the page too:

pages:
  projects:
    contact:
      title: Ask for an estimate
      text: Tell us about the job; we answer within two days.
      button: Send enquiry
      thanks: Thank you, we will be in touch.

A text, callToAction or features section may put a picture behind its content with image: { src: images/team.webp, alt: The team at work } in the content file. The section keeps the dark scrim facing its text on desktop and rising from the foot on mobile. The scrim stays strong enough for white type even over a white picture. It supplies the surface in place of the section's band for as long as the picture is present. Without the picture the existing surface is used. A features.items entry can also have its own image, with the same picture fields as a hero image. setSectionPicture changes the section picture or, with --item <zero-based index>, one feature card's picture. Removing a card's picture keeps its title and text.

A hero may use mark: logo in its look in smithable.ux.yml. The app's logo takes the place of the visible heading. The title still names the heading for assistive technology. The regular title appears when the logo is absent or the mark is title. In Studio these choices belong to the section's existing form.

A hero, and a features, records, pricing, testimonials, faq, contact, gallery or text section, may have an eyebrow: a short line over its title, such as what the section is (dishes: { eyebrow: Popular dishes, title: Favorite meals }), in the primary color (in a hero, in the hero's own text color). A section without one has none; setText "Popular dishes" pages home dishes eyebrow sets it.

A hero can have a picture beside its text: image: { src: images/hero.webp, alt: People stretching in a yoga studio }. The file lives in the app's public/images/ (webp, avif, jpg or png, about 1200×800), which generation never touches; alt says what the picture shows, for people who cannot see it, and is required. The Booking and Invoicing starters come with one. A picture may come in several widths, so a wide screen loads a sharp picture and a phone a small one: width: 1536 is the file's own width in pixels, and widths: [800, 2400] lists its copies', narrowest first, each a file beside it named by its width (images/hero-800.webp, images/hero-2400.webp); one to six copies, each from 100 to 4000 pixels, not on the logo; widths needs width beside it and a file name ending in a lower-case extension. A new app from a description gets them with its hero from the Smithable image library; choosing another picture style or changing src (Studio, setText) takes them off, since the copies were the old picture's. To replace the file by hand, remove width and widths or replace the copies too.

On the hosted service a picture may instead be a stored file from the business's photo library: image: { asset: m_01hz…, alt: …, width: 2400, widths: [480, 960, 1600] } names it by its id in place of src (exactly one of the two), and the app serves its copies as media/<asset>/w<width>.webp, fetched into public/media/ by the workspace (docs/design/media-storage.md). Only the service sets one, through setSectionPicture with --asset, after it has made the copies: it fills width (the largest) and widths from its own record, which nobody writes by hand, and a model is never offered a stored file. setText changes neither asset nor src over it, and a language file has none. An operation that would leave a place without the stored file it held (removing the picture, the section or the page, or choosing another) is confirmed for each such place, as any change that loses data. When the owner deletes a file from the library, the service takes it out of every app with removeMedia --asset <id> [--asset <id>…]: one change, one undo step, that empties every place naming those files, in every language file too. A section's own picture goes (a hero is then shown without one), a gallery's or media-and-text section's item goes with its caption, a features card keeps its words and a tile its label, and a hero's film goes whole; a gallery that lost every item is left with none. A file named nowhere changes nothing, and the change says so. Like --asset, it is a person's choice: no model is offered removeMedia.

A hero's picture may move: film: { src: images/hero.mp4 } beside its src plays a short silent loop over it, under the same wash, text and badge (docs/design/section-film.md). The picture stays: it shows first, and it is all that a visitor who asked for less motion or to save data, a printed page or a page without scripts gets. The film starts only while the hero is in view, is invisible until it plays, and a Pause button is shown while it runs; a visitor's pause holds for the page view. The file is an MP4 (H.264, no sound track, its index before its data), 3 to 12 seconds long, at most 1920 pixels on its long side and 1080 on its short, and at most 5 000 000 bytes and 5 Mbit/s on average; Smithable checks the name, and smithable validate reads the file and names the rule it breaks. On the hosted service a film may instead be a stored video, film: { asset: m_01hz…, heights: [720, 1080] }, served as media/<asset>/<height>.mp4 with media/<asset>/poster.webp (docs/design/media-storage.md §7): the service makes its renditions silent and at most 1080 high, so its source may be larger or have sound, and setSectionFilm --asset fills heights from the service's record and refuses a video that runs under 3 or over 12 seconds or has no rendition yet; a narrow screen plays the 720 rendition. Like a stored picture, only a person chooses one, and removeMedia takes it out. A film has its own origin, generated and kind as a picture has, and none of the picture's. Only a hero's picture takes one, and only in the content file: a language file's picture has none. An app without a film gets no film code.

generated: true on a picture (a hero's, a gallery's, or the logo) says an AI made it. The app then marks it, as the EU's AI Act asks of pictures that could pass for photographs, with the EU's common icon for AI-generated content in the bottom right corner, as one badge: on a picture across the page the EU's worded label ("AI GENERATED") in an English app, and in another language the icon with "AI-generated" in the app's language joined to it; alone on a small one, such as a gallery's. A picture styled where it is used is not marked (the cover hero under the theme's color, the centered one under its veil, the photo one under its scrim), and the logo never is, since a mark is not a photograph. The pictures from the Smithable image library carry it; a maker's own pictures carry it only when the maker says so, and changing a picture's src with setText takes it off. A hero's, a tile's or a gallery's picture may also say what it is with kind: ai-realistic (made by an AI and looking real), ai-drawn (made by an AI and drawn, such as a pastel or an ink wash) or photograph; Smithable writes it from the image library when it places a picture, and the badge's default follows it (aiBadge in the ux file). A picture marked generated: true without a kind counts as ai-realistic.

A gallery or mediaText section whose pictures present the owner's own work (finished jobs, a project) says so in the spec with pictures: work (jobs: { gallery:, pictures: work }); any other section with it is refused, and it is never guessed from a section's name. Before an app is published, Studio's release review lists the hero's picture and the pictures of such sections that an image model made (generated: true), since published as they are they would present work nobody did, and offers to replace each with the owner's own picture, to keep it, or to remove it. The review never stops a release. A gallery's picture is given by its place from 0: setSectionPicture home jobs 2 images/jobs-own.webp replaces it, and without a file removes it. Keep is the operation keepPicture <page> <section> [item], which writes kept: true on that picture in smithable.content.yml (--kept false takes it off); a kept picture is not listed again, and only the hero's pictures and those of a pictures: work section are kept. Both operations take --was <file>, the file the caller saw there, and change nothing when another file is there now (Studio's review sends it with each choice). kept is only allowed beside generated: true, and it goes by itself whenever another file takes the picture's place, by any operation; new words for the same file keep it. setSectionPictures home jobs work sets it; without work it takes it off.

Every model, field, choice value, page and menu named here must exist in smithable.yml; smithable validate checks this. Semantic text (description, intent, rules) is never shown to visitors, so help text belongs here.

Libraries for custom code (src/custom/) are declared in smithable.context.yml, the one file that names technologies, with exact versions: packages: { chart.js: 4.4.1 }, or with the operation setPackage chart.js 4.4.1 (none removes one). Smithable adds them to package.json; the stack profile's own packages (React, Drizzle, …) are refused, since Smithable keeps their versions in step.

A counter of visits is one line in smithable.context.yml, naming one provider with the app's id there: analytics: { plausible: shop.example.com }, { umami: <website id> }, { fathom: ABCDEFGH } or { google: G-XXXXXXXXXX }; the operation setAnalytics plausible shop.example.com sets it and setAnalytics none takes it away. Its script is loaded in a production build only (never in development or a preview), and the app's Content-Security-Policy allows its addresses and nothing more. Plausible, Umami and Fathom set no cookie and start at once; Google Analytics waits for the visitor's yes in the consent bar (design/analytics.md).

The consent bar is the kit's: shown at the bottom of every page when something asks for consent and no choice is kept, with Accept and Decline as equal buttons and a link to the page named privacy when there is one; the choice is kept in the browser for a year, and "Cookie settings" in the menu or the footer asks again. Its words can be changed in smithable.content.yml under consent: { text, accept, decline }. Custom code that embeds something needing consent (a map, a video, a chat widget) calls afterConsent(run) from #/kit/consent: run runs once the visitor has said yes, and the call makes the bar appear.

language is the language of the app for the people who use it: the words the app brings itself (Save, Cancel, the sign-in page, the mails) are in it, and dates and numbers in sentences the app writes follow it. The maker's own texts are as written, whatever it says. It must be a language the app kit has words in (en and sv so far; design/language.md); in another language than English every model should give its pluralLabel, since the plural made by an English rule would read wrong, and smithable validate warns about those that do not. The operation setLanguage sv sets it.

languages lists the other languages the app is offered in (languages: [sv]), each one the kit has words in and none the app's own. Each has its own file, smithable.content.<language>.yml, with the same keys as the content file and the texts in that language: any text a person reads, the content file's own and those Smithable derives from names (a model's label and plural, a field's label, a choice's values, a page's title, an action's button). It holds texts only: no language, languages, logo or initials, nor what no person reads as words (a picture's file, an address to go to, the operator's email or phone). addLanguage on a language listed whose file is missing writes the file again. A text left empty, or not there, shows in the app's own language, and smithable validate says how many there are (text-untranslated). smithable op addLanguage sv lists the language and writes its file with every text empty, to be filled in; setText … --language sv writes one; removeLanguage sv takes the language and its file away. smithable translate sv has the configured model draft the texts still empty (Studio's Languages tab has a button for it); they are saved with setTexts as one change, and undo takes it back. A renamed field or choice value follows into every language file. (design/languages.md.) The app's own language is at /; each other one at its code first (/sv/, /sv/menu): a public page in Swedish is a page of its own for search engines, with the other versions named beside it, and the sitemap lists every version. Signed-in pages keep one address and show the language last chosen with the switch at the foot of each page. A text the same in several places is translated once: when two places give it different words, the app shows the first and validate says so (text-shared).

logo is the app's mark: a file under the app's public/images/ (webp, avif, jpg, png or svg; square or nearly, about 512 px) and what it shows. It is drawn before the app's name in the menu and the landing page's header, and the browser's tab and an installed app's icons show it; without it the app shows its name alone. src must have that form (logo-src) and alt must be there (logo-alt); whether the file is there is not checked. The operation setLogo images/logo.webp --alt "A lotus" sets it, and setLogo without a file removes it. An app made from a description gets one from the Smithable image library when one of its marks fits the description, and none otherwise (design/app-logo.md).

The app's name is always its wordmark: in the heading font, a little tight, in the theme's heading weight and case. The browser's tab shows a tile of the app's initials (unless the logo stands in), a square with a fifth of its side rounded in the theme's light primary, the letters in the color on it, the same file for the same spec. The initials by rule are the first letter or digit of the first two words that have one (words are what spaces separate; emoji and signs are passed over; upper-cased, ß gives S and ʼn gives N; at most three combining marks on a letter), one when there is one word, none when the name has no letter. initials in the content file gives one or two letters or digits instead, each with at most three combining marks (initials-form otherwise); it is not translated. setInitials SW sets it and setInitials without letters goes back to the rule. smithable validate --explain says which initials are in force and why.

The operation setText changes one text by its path, e.g. setText "All our customers" pages customers subtitle (an empty text restores the default). A list item's text is addressed by its position, e.g. pages home faq items 0 question. Studio uses it when a text is changed in place in the preview. removePage removes a page's texts along with the page and takes it out of public.pages and off a landing hero's button and shortcuts (its confirmation says so), and removeSection a landing section's; addSection home gallery adds a section (with records, form or button as its options), which Builder offers as "A section on a landing page". addLandingPage home makes a landing page with a hero and a footer, at / when that is free, and lists it under public.pages unless public is false.

smithable.auth.yml: sign-in, roles and what is public

Required, next to smithable.yml. It is technology-neutral: no library names or keys (those are environment variables).

smithableAuth: 0.1

signIn:
  providers: [email]             # email (a code by mail, no keys), google, facebook; the order is the button order
  allowedDomains: [acme.com]     # optional: only these email domains may sign in
  selfSignUp: false              # optional: only invited people and admins (needs a users page)

defaultAccess: shared            # shared | private; required with sign-in (see Access)

roles:                           # optional; "admin" always exists and is always all
  admin: all
  sales:                         # what the role may do beyond the record rule (see Access)
    description: Works with customers and orders.
    pages: all
    create: all
    write: [Customer, Order]
defaultRole: sales               # the role new users get; needed with several roles
admins: [owner@acme.com]         # become admins when they sign in

# ⚠ PUBLIC: visible to anyone on the internet, without signing in.
public:
  pages: [schedule]              # pages anyone may open (the sign-in page always is)
  read:
    - Session                    # models anyone may read
    - Post: { where: { status: published } }   # …or only the records with these values
    - Incident: { where: { status: [investigating, identified, monitoring, resolved] } }   # one of several
  create: [ContactMessage]       # models anyone may create, e.g. a contact form

# What other programs may reach with a key (a key is made in the app, with a role).
api:
  models: [Customer, Order]      # or all, with except: [AuditEntry] for the ones left out
  actions: [markPaid]            # the standard actions they may run, and custom actions on rows (run on ids); or all
  assistants: true               # optional: offered to AI assistants as tools too

# "Ask", the assistant in the app, for the people who use it.
assistant:
  for: [admin, staff]            # roles; or signed-in (everyone who signs in); or anyone (visitors too)
  may: read                      # read (the default) | change: it also adds, changes and runs actions
Key Meaning
signIn none for an app without sign-in (then only public is reachable), or providers with optional allowedDomains and selfSignUp (true by default; false lets only invited addresses and the admins sign in, and needs a users page). setProviders email google sets the providers, in button order; setDomains acme.com sets allowedDomains (setDomains none lifts it)
defaultAccess shared or private: the default access to records (Access). The operation setDefaultAccess shared sets it
roles Role names (camelCase), each all (the whole app) or a block: an optional description and the grants pages, read, create, write, delete, actions and review (the models whose waiting files the role approves or rejects, Review), each a list of names or all (Access). admin always exists and is always all; so does a role for everyone else, member, when none is named. The operation grant <role> <what> <names…> sets a grant
defaultRole The role new users get; never admin (that would make everyone who signs in an administrator: an error)
admins Email addresses that get the admin role when they sign in with the address proven, also an address added after its account was made, and may always sign in. setAdmins you@your-domain sets them; smithable new puts in --admin or the Git user's address. A warning says when only invited people may sign in and there is no administrator (nobody could), and when an address is on a domain nobody receives mail at (.example)
public pages, read and create: what anyone may open, read or create without signing in. A users, data or review page is never public: it is refused under pages. A public page shows a visitor only records of models under read: smithable validate warns when a public page shows a model that is not there (its list or its cards would be empty). A model in read may be limited to records with certain values, Post: { where: { status: published } } (a choice field's value or a list of them, or a yes/no field's true or false): visitors, and signed-in people who read only because it is public, see those records everywhere (lists, searches, cards, references), while roles that may read the model and a record's owner see the rest as before. A mapping needs a real condition: - Post: {} or where: {} is refused (list the name alone to let visitors read every record), and so is a model listed twice. Removing the field or the value is refused until the condition is changed. The operation setPublicWhere Post status=published sets it (several values as the choices are written, `"status=investigating
api What other programs may reach with a key: models (a list, or all, which also offers models added later, as setApi and the summary say, with except for the ones left out), actions (standard actions of offered models, a list or all) and assistants (true to offer the same to AI assistants as tools; { delete: true } lets them delete too). Nothing is offered unless it is said here. Listing is not granting: a key is made in the running app by an administrator, with a role, and that role's access decides what the key may do, exactly as for a person. api needs sign-in. A warning names offered models with personal data. The operation setApi Customer Order --actions markPaid sets it (setApi all --except AuditEntry; setApi alone turns it off). The app serves it under /api/v1 with its description at /api/v1/openapi.json; Let other programs use your app walks through it. With assistants, the same is offered as tools for AI assistants at /mcp; they may delete only with assistants: { delete: true } (setApi … --assistants true --assistants-delete true) and a key whose role may delete. Without a key, a program or assistant is a visitor: it may list and read the offered models that public.read lets anyone read (with their where) and add to those public.create lets anyone add, never change, delete or run an action; the description and the tools show it only that (a key or a session that may open the users page sees the whole description), and with nothing public every call needs a key and the description names nothing
assistant "Ask", the assistant in the app (design): for is the roles that get it ([admin, staff]), or signed-in (everyone who signs in), or anyone (visitors too, who are answered by the app's wording rules over what is public and never by a model); may is read (the default: it finds, counts and adds up) or change (it also adds, changes and runs standard actions, each confirmed by the person; it never deletes). It acts as the person asking, so it reaches what they may. Without the block the people who use the app do not get it. The operation setAssistant [roles… | signed-in | anyone] [--may read|change] sets it; with nothing it is switched off

smithable validate warns about risky combinations, and never changes their meaning: shared access with open sign-up and no allowedDomains (anyone with an account at the provider can sign up and read everything), and public reading of models with personal data (email, phone or User fields). Everything named in public must exist in smithable.yml, and every role used there must exist here.

In development, the sign-in page also offers signing in as any role, without contacting the provider. Production builds leave that out.

smithable.ux.yml: how the app looks

Optional, next to smithable.yml. It changes how the app looks, never what it does, and names no technology: presets and choices, not CSS.

smithableUx: 0.1

theme:
  preset: corporate                          # modern (default) | minimal | playful | corporate
  brand: { primary: "#1d4ed8", background: "#f5efe6", font: Inter }  # optional
  density: compact                           # comfortable | standard | compact; the preset's own unless set (corporate is compact)
  motion: subtle                             # none | subtle | lively; the preset's own unless set (playful is lively)

pages:
  customers:
    icon: users                                  # its icon in navigation (optional)
    filters: { shown: [segment, creditLimit] }   # the filters shown when the list is first reached; the rest fold behind "More filters" (one with a value in the address shows anyway)
    # on orders: filters: { pick: { customer: search } }  # how a filter on a reference is picked: list (every related record as a choice) or search (a field that finds them as you type); unsaid, by the count: a search from 200 records the viewer may read. Which fields filter is smithable.yml's; this says only how a filter is picked; a reference to a person keeps its own filter (Mine, Unassigned, the people)
    table:
      columns: [name, email, segment]            # which fields the list shows, in order; without it: the title, a picture, the required fields, then the rest, five at most, no long text unless the model has no short text to be titled by
      below: { email: phone }                    # a second field under a column's value
      sort: -creditLimit                         # the order until someone sorts; "-" for largest or latest first
      view: cards                                # cards on wide screens too (table by default)
      totals: [creditLimit]                      # a last row with the sum of each of these numbers or amounts, and the count, over every record the viewer may see that fits the filters and the search
    record:
      lists: { orders: table }                   # a list on the record page: table (default) or thread
      subtitle: email                            # the line under a record's name on cards and in pickers: a name part
      detail: [segment, creditLimit]             # smaller parts after it
    form:
      fieldOrder: [name, email, phone]           # these first; the other fields follow (or sections, not both)
      sections:                                  # groups with headings; fields in none follow at the end
        - { name: contact, fields: [name, email, phone] }
        - { name: terms, fields: [creditLimit, segment] }
      columns: 2                                 # short fields two abreast on wide screens
      control: { creditLimit: slider, segment: radio }   # how a field is entered
  mortgage:
    form: { results: below }                     # a calculator's results under its inputs
  about:
    frame: site                                  # site | app | none: the public frame, the workspace, or the page alone
  home:
    theme: { preset: playful, brand: { font: Nunito Sans } }   # a landing page's own theme
    header: { position: scrolling }              # sticky | scrolling: the header kept at the top as the page scrolls, or away with it (sticky); over: hero
    width: wide                                  # contained (72rem) | wide (80rem) | full
    sections:                                    # a landing page's sections' looks, by section name
      hero: { layout: split, image: left }       # split | centered | plain | cover | photo; the picture's side
      features: { columns: 4 }                   # 2 | 3 | 4 | 5 | 6 (3)
      classes: { layout: grid, columns: 6 }      # records: cards | list | grid; columns 2–6 (cards 3, grid 4)
      testimonials: { layout: carousel }         # cards | carousel | one
      pricing: { highlight: Pro }                # the plan drawn forward, by its name
      faq: { layout: list, columns: 2 }          # accordion | list; a list's columns 1 | 2 (1)
      gallery: { columns: 4 }                    # 2 | 3 | 4 | 5 | 6 (3)
      callToAction: { band: primary }            # any section but the hero and footer: none | muted | inverse | primary (none)

tones:                                       # colors of choice values, by meaning
  Order.status: { shipped: success, canceled: danger }   # success | warning | danger | neutral

navigation: topbar                           # the menu in a bar across the top (sidebar by default)
chrome: light                                # the menu on the page's own colours (the theme's by default)
aiBadge: false                               # no badge on pictures an AI made (unsaid: by each picture's kind)
pictures: { style: pastel }                  # the image style of the app's library pictures

assistant: { voice: friendly }               # Ask's manner: plain (the default) | friendly | formal

Section rhythm, media composition and named record emphasis

A named mediaText section reuses plain content text, an optional image and an optional page button. For example, story: { mediaText: true, button: schedule } belongs under a landing page or the existing mixed-page sections. Its content at pages.about.story accepts eyebrow, title, text, button, caption and image: { src, alt, generated }. The image uses the existing path/alt validation; paragraphs split on blank lines. No image leaves the text and link. The section has an h2 under the page heading.

Choose layout: collage to place the main image and up to three extra pictures in the same section. The pictures overlap at wider widths and form a grid on a phone. Each can be opened at full size. Write extras under the section's items as - image: { src, alt }, or add them in order with setSectionPicture about story images/work.webp --item 0 --alt "Wooden stool". Using a different layout keeps the extras in the content file for when the collage is restored. The collage choice belongs to the section, and is unavailable as a theme default.

# smithable.ux.yml
pages:
  about:
    sections:
      story:
        layout: split       # split | stacked | collage; split stacks below the wide breakpoint
        image: left         # left | right; semantic/keyboard order stays text then picture
        rhythm: airy        # compact | standard | airy
        measure: reading    # reading (66ch) | wide (80ch), body copy only
        fit: cover          # cover | contain
        aspect: portrait    # landscape (3:2) | portrait (3:4) | square
        focal: left         # center | top | bottom | left | right

setSectionLook about story rhythm airy uses the normal operation; inherit removes the choice. Rhythm is separate from theme control density: compact uses spacing 6 (4 on phones), airy uses 20 (12 on phones), standard preserves the section's own spacing. It changes section padding and section gaps, never button/input/row sizes. Existing framed sections offer rhythm; text and mediaText offer measure. Hero, footer and custom sections have their own controls. Omitting these choices preserves existing output. Theme section defaults use the same finite choices and normal provenance; explicit section values win.

Gallery, mediaText and the hero offer fit/aspect/focal; record pictures keep their existing presentation. A split or inset hero's framed picture takes all three (unsaid, its own shape); a picture across the hero fills it and takes focal alone, the point kept in view when it is cut. Named ratios reserve space before loading, and the full-image native dialog always uses contain so cropping never removes access to the complete image. Caption and alt remain content. Cover, including duotone styling, is presentation and cannot promise that an arbitrary crop tells the whole story. Missing/slow images keep the reserved frame.

On a CRUD page, optional record.summary: { status: [payment], amount: [actual], dates: [due] } selects readable fields for the existing header/aside summary. Status takes at most one choice, amount one money field/formula, dates up to two date/date-time fields in authored order. An omitted slot keeps the existing automatic selection; [] explicitly shows none. It grants no field or record access. All-empty selection removes the summary and its empty aside. setRecordEmphasis invoices amount actual selects a field; omit fields to restore automatic, or pass --fields "" for none. Studio offers automatic, none and compatible field pickers. Renaming follows the binding; removing a selected field requires changing/resetting the selection first. Existing summary/activity/queue sections compose workflows without tab groups or a new page kind. Form errors keep the existing visible field/error behavior.

Themes

A theme is data, never CSS: a font, a corner radius, a shadow and the colors the app uses, in light and dark mode. The mode shown is the visitor's: System (the device's setting) unless they chose Light or Dark under Appearance, kept in their browser and applied before the page first paints. The built-in catalogue contains the themes Smithable ships (smithable themes lists your installed version); a project's own go in themes/<name>.yml (written through addTheme <name> --text @file [--use], refused with the file's problems) and theme.preset names either. smithable theme --from <url> [--name x] [--use] makes one from a site: a browser (Playwright) reads its background (the page's own before its bands), text, primary button color (a link styled as a button counts), cards, corners and font (a hosted font by its own name, its headings' too when they differ) in light and dark, in any CSS color (Tailwind 4's oklch too), with the dark mode a page switches by a class (.dark or data-theme="dark" on <html>) when the device's setting changes nothing; it derives the rest, raises contrast where it would not read, and adds it with addTheme.

A strong pink, orange or blue accent needs a look on real pages in both modes. Contrast is the automatic floor; visual balance is judged in the preview. There is no automatic accent-strength limit.

The built-in themes, each in light and dark:

Preset What it looks like
arcade Bungee headings over Chivo; #f3580e primary on #fdf8ff
darkmatter JetBrains Mono headings over JetBrains Mono; #d87943 primary on #ffffff
halftone Zilla Slab headings over Hanken Grotesk; #c92d09 primary on #f9f3db
starry-night Newsreader headings over Newsreader; #3a5ba0 primary on #f5f7fa
nature Outfit headings over Outfit; #2e7d32 primary on #f8f5f0
dusk Hanken Grotesk headings over Instrument Sans; #7581b5 primary on #f1f4ff
hallmark-midnight Mona Sans headings over Hanken Grotesk; #4d95b6 primary on #f8faff
ultraviolet Outfit headings over Hanken Grotesk; #6b2ae3 primary on #f0ecfa
ribbon Instrument Sans headings over Hanken Grotesk; #035f5c primary on #fcf9f3
studio Instrument Serif headings over Inter; #e97219 primary on #f1f7f8
vantage Hanken Grotesk headings over Hanken Grotesk; #7c9d39 primary on #f6fcff
specimen Bodoni Moda headings over Inter; #144bb7 primary on #f9f3e8
spore Young Serif headings over Instrument Sans; #be8176 primary on #fff7f0
sticker Big Shoulders Display headings over Hanken Grotesk; #d3036a primary on #f5f0e7
broadside Oswald headings over Hanken Grotesk; #c12b09 primary on #ece4d0
solstice Bodoni Moda headings over Hanken Grotesk; #c9212e primary on #f6e9d5
kiln Bodoni Moda headings over Inter; #e5610a primary on #fffbfa
refract Hanken Grotesk headings over Hanken Grotesk; #066c95 primary on #faf9f5
terrazzo Outfit headings over Hanken Grotesk; #b14420 primary on #f5f1eb
sunset-horizon Outfit headings over Outfit; #ff7e5f primary on #fff9f5
amber-minimal Inter headings over Inter; #f59e0b primary on #ffffff
coral Hanken Grotesk headings over Hanken Grotesk; #ef8b7b primary on #f8f4f1
amethyst-haze Inter headings over Inter; #8a79ab primary on #f8f7fa
cosmic-night Inter headings over Inter; #6e56cf primary on #f5f5ff
caffeine Inter headings over Inter; #644a40 primary on #f9f9f9
ink Hanken Grotesk headings over Hanken Grotesk; #01736c primary on #fefdfb
riso Mona Sans headings over Source Serif 4; #fe419d primary on #f8f5ed
vellum Bricolage Grotesque headings over Hanken Grotesk; #2942ab primary on #f3eada
loom Instrument Serif headings over Hanken Grotesk; #1d3172 primary on #f4f0e6
terminal JetBrains Mono headings over Hanken Grotesk; #54a14d primary on #f6fef8
neo-brutalism DM Sans headings over DM Sans; #ff3333 primary on #ffffff
sport Oswald headings over Hanken Grotesk; #c8e928 primary on #f6f9fc
squeeze Outfit headings over Hanken Grotesk; #8d6344 primary on #d0e4d5
midnight-bloom Outfit headings over Outfit; #6c5ce7 primary on #f9f9f9
rim Instrument Sans headings over Hanken Grotesk; #e17038 primary on #fffbf6
elegant-luxury Outfit headings over Outfit; #9b2c2c primary on #faf7f5
darkroom Oswald headings over Hanken Grotesk; #c1732f primary on #fffbf8
tangerine Inter headings over Inter; #e05d38 primary on #e8ebed
mono JetBrains Mono headings over JetBrains Mono; #737373 primary on #ffffff
mocha-mousse DM Sans headings over DM Sans; #a37764 primary on #f1f0e5
graphite Outfit headings over Outfit; #606060 primary on #f0f0f0
notebook Nunito Sans headings over Nunito Sans; #606060 primary on #f9f9f9
modern-minimal Inter headings over Inter; #3b82f6 primary on #ffffff
manifesto Oswald headings over Hanken Grotesk; #db0310 primary on #fffbf6
solar-dusk Outfit headings over Outfit; #b45309 primary on #fdfbf7
sage-garden Hanken Grotesk headings over Hanken Grotesk; #7c9082 primary on #f8f7f4
grid Hanken Grotesk headings over Hanken Grotesk; #1f40be primary on #f8f7f3
furrow Hanken Grotesk headings over Hanken Grotesk; #fc6b33 primary on #f5f1ea
modern indigo on a cool white, rounded, Inter; the default
minimal near-black on a warm white, quiet colors, light borders, Inter
playful bright violet, very round, pill buttons, Nunito Sans
corporate muted teal on a cool grey-white, square corners, compact, tabular numbers, Source Sans 3
coastal deep teal on warm sand, rounded, soft shadows, Nunito Sans
navy deep blue on a cool white, square corners, compact, Source Sans 3
editorial plum on warm paper, nearly square, no shadows, Source Sans 3
woodland forest green on a green-tinted white, soft corners, Source Sans 3
contrast dark red on pure white with near-black text and strong borders, Inter
nordic petrol blue on a cool white, calm, soft shadows, Inter
pastel mauve on a pink-tinted white, very round, raised shadows, Nunito Sans
midnight indigo on a cool grey-white, crisp corners, no shadows, a deep navy dark mode, Inter
craft rust on warm cream, rounded, soft shadows, Nunito Sans
restaurant forest green on cream, flat cards, large Fraunces headings over Source Sans 3
street-food a hot red on near-black and white, square, boxed sections, strong lines, Archivo Narrow headings in capitals over DM Sans
cafe terracotta on warm neutrals, very round, raised cards, pill buttons, no lines, Nunito Sans
warm-service deep green on warm off-white, rounded, no shadows, DM Sans
quiet-workspace calm blue on a cool grey-white, compact, small shadows, Inter
ink-and-brass ink navy on warm paper, with a brass primary in dark mode, no shadows, Source Sans 3
workbench a quiet near-white workspace with a light sidebar and a teal primary, compact, tight Inter headings at weight 600, round pictures (the CRM starter's)
stillwater one ink on warm paper, DM Sans headings at 800, large and tight, over Source Sans 3, square bold buttons, 4px corners, a soft shadow (the booking starter's)

The gallery begins with the selected catalog themes, in palette and typography order; modern remains the default. Modern, minimal, playful and corporate come from the design delivery. The other built-ins (including the theme lab's styles and the starters' own) are theme files like a project's own, kept inside Smithable and checked the same way; a project may still have a theme of its own under any other name (forest, say).

# themes/forest.yml
smithableTheme: 0.1
name: forest                   # kebab-case; the file's name when left out
fonts:
  body: Nunito Sans            # a hosted font (below); not a display face
  heading: Fraunces            # optional: the headings' font; the body font when left out
  labels: JetBrains Mono       # optional: the face of column labels, eyebrows, tags and small figures; the body font when left out
radius: 12px                   # corners: a length in px or rem
shadow: soft                   # none | soft | raised
motion: subtle                 # optional: none | subtle (default) | lively
density: comfortable           # optional: comfortable (default) | standard | compact
chroma: 0.22                   # optional: how much color a brand color keeps on this theme (0–0.4)
texture: none                  # optional: none (default) | grain | paper, a quiet surface noise or a paper fibre, drawn by the app's stylesheet alone
modes: both                    # optional: both (default) | light | dark; a one-mode theme gives that mode's colors alone, the app shows it whatever the device says, and has no mode switch
headings: { weight: 600, tracking: normal, scale: large }   # optional, like the groups below
surfaces: { cards: flat }
light:
  primary: "#2f6b3a"
  background: "#f6f8f4"
  foreground: "#1f2a1f"
dark:
  primary: "#8fd19a"
  background: "#141a14"
  foreground: "#e6ece4"

A theme may also supply finite UX defaults:

defaults:
  app: { navigation: topbar, menuActive: underline }
  kinds:
    landing: { width: wide, header: { position: scrolling } }
    crud: { table: { mark: initials, actions: menu }, record: { header: summary } }
    calendar: { calendar: { view: agenda } }
  sections:
    hero: { layout: cover, overlay: dark }
    records: { layout: ledger }

The order is platform fallback, app theme defaults, a landing page's own theme defaults, then explicit UX. app takes menu layout/surface/active indication. kinds takes the finite shell/list/calendar/record choices offered for that page kind. sections takes finite section looks such as layout, columns and band. Page ids, field/model references, content, permissions, CSS and expressions are refused. The published theme schema lists the exact choices.

An unusable inherited choice is skipped through the normal contextual validation, with its reason in smithable validate --explain. Explicit invalid UX still reports an error at its source. Inferred values are never written into smithable.ux.yml. Existing themes without defaults keep their behavior. Literal platform choices (including none, contained, week and filters' default) mask theme defaults; their operations offer a separate inherit reset. A theme change preserves explicit choices. Studio distinguishes authored and inherited values.

smithable.context.yml: how the app is built

The one file that may name a technology. It says how the app is built, never what it does: a functional requirement belongs in smithable.yml, a look in smithable.ux.yml, a text in smithable.content.yml.

smithableContext: 0.1
adapter: tanstack                 # the stack profile (one so far) and its database
database: sqlite
conventions:                      # read by a model that writes custom code or a plugin
  - Prefer existing components before creating new ones.
guidance: >
  Tables should be compact; this is a back-office tool used all day.
plugins: [newsletter]             # project plugins, see "Sections Smithable does not know"
packages: { chart.js: 4.4.1 }     # libraries for src/custom/, at exact versions
analytics: { plausible: shop.example.com }   # a counter of visits, one provider
payments: { provider: mollie }    # stripe | mollie | fake: who takes the payments
ai:
  policy: best-available          # local-only | eu-only | best-available (the default) | custom

The file is checked against its JSON Schema (CONTEXT_SCHEMA in core): smithableContext: 0.1 and only the keys above. smithable validate reports a problem on its key, and an operation that changes the file is refused if it would leave it invalid.

Sample data

A project may give its models sample records in samples/<Model>.yml, beside themes/: a list of records with the model's field names as keys. pnpm db:seed (and smithable new) adds them instead of generated ones; a model without a file still gets generated records.

# samples/ClassType.yml
- name: Hatha
  summary: Slow, steady postures held for a few breaths each.
  level: allLevels                    # a choice by its value or its label
  price: 16.50                        # money as an amount
  instructor: Emma Lindqvist          # a reference by the record's title (samples/Instructor.yml)
  photo: { file: hatha.webp, alt: A class stretching }   # a file in public/images/samples/

Importing records

Existing records come in from a spreadsheet saved as CSV: smithable op importRecords Customer --from customers.csv (in Studio: Change → Records from a CSV file).

Not supported

Smithable specs are plain data. YAML anchors (&name), aliases (*name) and tags (!!str) are rejected, because they make specs hard to read and unsafe to edit automatically.

Text is plain text too, in every spec file. A name, a label, a title or a subject is one line; the longer texts (description, intent, the rules, a section's text, help, answer, quote, an address or opening hours) may run over several. Invisible control characters, the rare line breaks U+2028, U+2029 and U+0085, and the characters that reverse the order text is shown in are refused anywhere, since they make a text read otherwise than it is.