Globetrotter docsversion 0.3.0 · 2026-12-04

Reference

On this page
  1. The vocabulary by part
  2. Value types
  3. Primitives
  4. Tenants
  5. What each target emits
  6. Routes
  7. Sign-in settings
  8. Service lint
  9. Environment variables

Every primitive a service design is built from, every prop, the routes they become, the lint rules that read a service, and the environment variables a generated backend reads. The primitives come from packages/primitives/src/catalog.ts; if this page and the catalogue differ, the catalogue is right.

On this page: The vocabulary by part · Value types · Primitives · Tenants · What each target emits · Routes · Sign-in settings · Service lint · Environment variables

A name is the same everywhere: it starts with a letter, then letters, digits or _. Each target spells it its own way (thread_id in Python, threadId in TypeScript). Two siblings of a kind cannot share a name, ignoring case. An event is dotted lower-case words, like thread.archived. A route is lower-case words, digits and - separated by /, like /threads. A secret is written {secret:NAME}; a credential written into a design is refused.

The vocabulary by part

What a design can say beyond entities and plain operations, and where each part is on this page. The props and their defaults are in the section named; the lint rules are in Service lint under the prefix; the routes and headers are what the contract gains.

Part Props Lint rules Routes and headers
Filters, sort, pages Query: where, sort, sortable, paging, pageSize, maxPageSize, searchIn, total. Param: filter, field, many where-, filter-, sort-, search-in-, paging-, cursor-, page-size-, list- Query params sort, page, size, cursor; X-Total-Count, X-Next-Cursor, X-Truncated
Many-to-many Relation: joined, inverse, through joined-, inverse-, through- <relation>Ids on a create or update
Tenants Tenants: the tenancy section, an entity's scope, an operation's allowIn and grants, a handler's tenantFrom tenant-, webhook-handler-tenant GET /tenancy, POST /tenancy/actions/select; the X-Org header
Shapes Shape, Part shape-, part-, cache-shape None of its own: a Query or Command returns it
State transitions Machine, Transition; a Command's does: transition and transition machine-, transition- A 409 on the command; x-globetrotter.transition
Versions Entity: versioned, ifMatch versioned- The If-Match and ETag headers; a 400, a 412 and (under required) a 428 on the write; a 409 on a write that can lose a race with no If-Match; x-globetrotter.ifMatch
Idempotency keys Command: idempotent, keepFor idempotent- The Idempotency-Key header; Idempotent-Replayed on a repeat's answer; a 400, a 409 and a 503 with Retry-After, and a 422; x-globetrotter.idempotent (keepFor)
Rate limits Query, Command: limit, limitBy; the design's limits section (default, by, store, signIn) limit- A 429 with Retry-After on a limited operation; x-globetrotter.limit (n, seconds, by); the sign-in paths' 429 when limits.signIn is written
API keys API key sign-in: keys: managed, prefix, make, scopes, expiresIn, graceFor; Query, Command: scope apikey-, scope- GET /apikeys, POST /apikeys/actions/create, POST /apikeys/{id}/actions/rotate, POST /apikeys/{id}/actions/revoke; a scope's 403; x-globetrotter.scope
Outbound clients Client, Call; a Param in: header client-, param-header-outside-call None: a client is called from your code
Inbound webhooks Webhook, Handler webhook- POST {path} (default /webhooks/{name})
Files in a bucket File: backend; the files block of a components file file-s3-needs-bucket GET /files/{name}/{id} answers 302

Route shape itself (methods other than GET and POST, your own paths) is not part of the vocabulary yet: see Routes and Limits.

Value types

A row's schema says its shape; the rules are on what you send. The contract's schema for an entity's row (the component marked x-globetrotter.entity, and the <Entity>Linked twin inside a joined list) carries the type, the date-time, date, uuid, int64 and decimal formats, the enum and nullability, and never maxLength, minLength, minimum, maximum, pattern, multipleOf or the email and uri formats: a rule tightened after rows were stored leaves old values a read still returns. The bounds in the table below, and every other rule, sit on the inputs (params, a form's body), where each request is checked.

Used by fields and params:

Type Holds In the contract
string short text: 255 characters at most unless it says its own max; no NUL string; maxLength on an input
text long text: no length unless it says one; no NUL string
int whole number integer, int64
float number number
decimal exact number, such as money string, format decimal; an input (a param, a form's field) also has the pattern ^-?[0-9]{1,14}(\.[0-9]{1,4})?$ (what the stores keep: 14 digits, then 4 after the point) and the example 19.99; anything else is a 400. On a sqlite store the field's schema also says At most 15 digits in all (a float holds no more exactly), which both targets refuse; postgres and mysql keep exactly the 18 digits. With a min of 0 or more the pattern takes no minus.
boolean true or false boolean
uuid an id string, format uuid
date a day string, format date
datetime a moment string, format date-time
json any JSON unconstrained
enum one of a list string with the listed values

A field that may be left out (not required, or with a default) and whose value has a shape (datetime, date, uuid, decimal, or a format of email, url or timezone) treats a blank value ("" or only spaces) as not given: the service reads it as absent, and the contract allows it beside the shape (anyOf with a blank pattern). A required one blank is a 400.

Primitives

Props marked "ref" name another node, by its id. Defaults are what an unset prop means; a blank default means unset.

Store

Where rows live. Section: stores.

Prop Type Default What it does
name name The store's name in code, like db.
kind postgres sqlite mysql mongodb duckdb redis postgres The engine family. Connection and a lighter engine for a laptop come from the components file.
migrations files none files files: each change is a numbered SQL file you apply. none: no schema (redis).

Entity

A thing the backend stores. Section: entities.

Prop Type Default What it does
name name The entity's name, like thread.
store ref Store Where its rows live.
audit full changes fields none changes A row per write, in the same transaction. full: whole row before and after. fields: only the named ones.
auditFields text With audit fields: field names, comma-separated. A personal field named here keeps its value in the audit.
softDelete boolean false Delete marks a row gone instead of removing it, so undo is free.
owner text A field naming whose row it is. Each person then sees only their own rows. <relation>.<field> (member.email) says a row is the asker's when the row its single relation points at holds the asker's id in that field: Own rows through a relation.
seesAll a role of the ladder With an owner: the lowest role given every row, not only its own (librarian). Unset, only the top role. Python serves it; Rust refuses it at sync (owner-sees-all). See Who sees every row of an owned entity.
scope tenant membership rows global With tenants on: tenant the organisation itself, membership who belongs to which, rows each row belongs to one organisation (through its one required single link to it), global shared by every organisation on purpose. Left out, nothing is scoped.
idKind uuid7 uuid4 serial ulid uuid7 How a new row gets its id when its key has no value. uuid7 sorts by time.
versioned boolean false Each row carries a version, raised by one on every write; a write may name the version it read (Versions).
ifMatch optional required optional Only with versioned: true. required: a write with no If-Match is refused (428).

Slots: fields (Field), relations (Relation), indexes (Index), machines (Machine).

Versions

What it is for, with pictures: Concepts. What has been run on which target and engine: Targets.

versioned: true gives the entity a column version: a whole number, 1 on a new row, raised by one on every write. It is the entity's own, not a Field of the design (a field named version is the lint error versioned-field-clash). The contract's schema of the entity gains version (an integer, readOnly, required), so every answer that holds the row holds it.

Header Where What it is
ETag The answer of a Query that gets one row by its key, and of a Command (not many, not a delete) whose returns is the entity; a create too. The row's version as a strong tag: "7". A list answers none: its rows carry version.
If-Match A Command whose does is update, delete, restore or transition on the entity. A create and a custom command take none. One strong tag ("7"), or * for any version.

What such a write answers that others do not. A message named in code is a key of the design's words and can be changed there.

Status When Message
428 ifMatch: required and no If-Match came. Answered before the row is looked for, so an unknown id with no header is a 428, not a 404. needsIfMatch: Send If-Match with the ETag you read.
400 If-Match is a weak tag (W/"7"), a list, a bare number or anything else. If-Match must be one ETag like "7", or *., with field: "If-Match"
412 The tag is not the row's version now. Nothing is written. staleVersion: This {entity} was changed since you read it: read it again.
409 No If-Match came (ifMatch: optional, or a custom command, which takes none) and another request wrote the row between this one's read and its write: nothing is written. Send it again. On postgres and mysql; rare on sqlite, whose writers take turns. raceRow: Another request changed the same row at the same moment: try again.

The row not there is a 404 before the 412. On a transition the 412 comes before the 409 for the state. With ifMatch: optional a write with no If-Match runs as it always did, and still raises the version. The contract lists the 400 and the 412 (and the 428 under required) on the operation, the 409 where a write can lose a race with no If-Match, with the header and x-globetrotter.ifMatch: optional or required.

ifMatch on an entity that is not versioned is refused when the design is read: doc says ifMatch, and it is not versioned: set versioned to true, or take ifMatch away.

Field

One value a row holds.

Prop Type Default What it does
name name The field's name, like createdAt.
type value type string string is short text, text long; decimal keeps money exact.
key boolean false The field that identifies a row. One per entity.
required boolean true A row cannot be saved without it.
unique boolean false No two rows share its value.
default text A new row's starting value, written as text (false, 0, Open).
values text For an enum: its choices, comma-separated.
min number The shortest text, or the smallest number.
max number The longest text, or the largest number.
format none email url timezone none A shape for text: an email, an http(s) address, or a zone like Europe/Lisbon.
pattern text For plain text: a regular expression the whole value must match, from ^ to $. A create or an update takes it for its param of this field; both targets refuse a value that does not match, with the field's message. Not with a format or choices.
message text What a person is told when a rule breaks.
personal boolean false About a person: lint asks for its entity to be audited, and an audit row keeps "[personal]" in place of its value, null where there was none (Audit).
sensitive boolean false A hash, key or token: kept out of audit records, sample rows, press results and traces.
readFrom a role of the ladder The lowest role that may read the field (clinician: clinicians and above). Below it the row comes without the property (absent, not null), it cannot be set, and it cannot be filtered, sorted or searched by. Needs sign-in; refused with sensitive, on the key, the owner field, a field a where keeps to =me by, and the membership's user and role fields. Python serves it; Rust does not write it yet: a design that uses it is refused at sync on Rust (target-unsupported, feature field-read-from). See A field only some roles may read.

A value over the longest length is told the limit itself ("The title takes at most 120 characters."), unless that limit is the field's only rule.

Own rows through a relation

owner on Loan says member.email: a member sees the loans whose member is the Member row whose email is them. In a request (sign-in on) a list, a count, a get, an update, a delete and a Shape's counts find only those rows (another's is a 404, as an owner field's), the top of the ladder sees every row, and a create or an update that names a member of someone else is a 404 naming it (NotFound on the link). Inside your own code (every=True, no request) it is not applied. The person is what sign-in gives: a password person's email, lower case (the field is compared lower case), a token's sub, so keep that value in the field. The field is short text, the relation a single one, and both entities in one store. Lint owner-not-applied says a path that reads nothing (an error: the rows would be everyone's); owner-via-beside refuses it on an entity that also has a Search, a state machine, versions or organisations, which would read rows the rule does not limit yet. Both targets write it (Rust as an exists on the linked table in its repository). It is the one-row-per-person rule's sibling: it limits reads, it does not make a row.

Relation

A link from one entity to another.

Prop Type Default What it does
name name The relation's name, like tasks.
to ref Entity The entity it points at.
many boolean false On: a row holds a list of them. Off: it points at one.
onDelete restrict cascade setNull restrict restrict: refuse to delete while pointed at. cascade: delete these too. setNull: forget the link.
required boolean false Label "Always". With many off: the link column is NOT NULL and a create needs its <name>Id.
joined boolean false Label "Both ways". With many on: many to many, through a join table the engine makes (product_tags: one row for each link, its two keys the primary key). Off: the other entity holds the link, one to many.
inverse ref Relation With joined: the same join seen from the other entity. One of a pair names the other; the one that names nothing owns the table (its onDelete is the table's). Left out, the link is one way.
through ref Entity The entity that is the join, when the link has fields of its own (a technician's role on a job). It has one required single link to each side and, advisably, a unique index over the pair. No table is made; its own is the join. Implies joined. Read only here: its links are rows written through its own operations.

A joined list is held as the other entity without its own joined lists (TagLinked in the contract), so two entities joined to each other never hold each other without end. onDelete on the owner: cascade takes the links with the row that goes, restrict refuses the delete (409, "That tag still has products: take them away first.") while one is linked, setNull is refused by lint.

A create or an update sets a joined relation's links through a body param named <relation>Ids (tagIds for tags; technicianIds for technicians), a list (many) of the other entity's keys: sending it replaces the set (an empty list takes them all away), leaving it out leaves the links as they are, an id that is not there is a 404 ("No tag has that id."), the same id twice is one link. The repository has link, unlink and set_links for your own handlers (Rust: link_<relation>, unlink_<relation>, set_<relation>, and <relation> to list).

Index

A lookup, a uniqueness rule (for every row, or for some), or a no-overlap rule.

Prop Type Default What it does
name name The index's name, like byOwner.
fields text Field names, comma-separated, in lookup order. createdAt and updatedAt may be named, unless the entity has a field of that name.
unique boolean false No two rows may share these values.
noOverlap text Label "No overlap between": two fields, start and end. Rows sharing fields may not have overlapping spans.
when text With unique: the rows it holds for, read as a Query's where over the entity's own fields and single links, with =, !=, =null, !=null only (no today or now, no path): returned=false. No two rows where when is true may share fields; the rest are free.
message text With noOverlap, or unique and when: what the caller is told on a clash (409). For unique with when, left out: That Loan is already there for the same item.

noOverlap is an EXCLUDE constraint on postgres and a trigger on sqlite; mysql does not keep it. A clash answers 409. Leave fields empty to keep every row apart.

unique with when is a unique for some rows: "an item that is out cannot be lent again" is Loan's Index fields: item, unique, when: returned=false, message: That item is already out. It is a partial unique index (CREATE UNIQUE INDEX ... WHERE "returned" = 0) on sqlite and Postgres, written by a migration sync makes (a save never applies it); a deleted row of a soft delete entity is left out. MySQL has no partial index: the repository checks in the transaction before it writes (two requests at the same instant can both pass there). A create, update or restore that breaks it answers 409 with the words (in the contract as that operation's 409, with x-globetrotter.uniques); the words are the Index's message, else That <Entity> is already there for the same <fields>. Lint index-when-invalid says a when that reads wrong, a comparison, today or now, or one with no unique. Rust writes it too: the partial index is the database's, and its refusal is answered in the Index's words.

Service

A group of operations under one route. Section: services.

Prop Type Default What it does
name name The service's name, like Threads.
route route The path its operations answer under, like /threads. One service per route.

Slot: operations (Query, Command).

Query

An operation that reads.

Prop Type Default What it does
name name list, get or any other name; see Routes.
returns ref Entity or Shape The entity it answers with, or a Shape: counts, totals, a report that is not a row. A Query made by name in a service about one entity (add_operation) has it, and many, read from the name where it says them surely (get, getJob, job: one row by its key; list, all, listJobs, jobs: its rows).
many boolean false On: it answers a list.
where text For a list: what a row must have, comma-separated. starred=true, status=Open, price>=10, archivedAt=null, technician!=null, start<2026-01-01 (=, !=, >, >=, <, <=). A single relation (assignee=<key>, assignee=null) and a row time (updatedAt>=<instant>) may be named: see A list kept by a link. A field across a single relation (item.category=camping) and the words today and now (due<today) too: see A where across a relation, and on now. me is reserved: the person signed in (assignee.userId=me; sign-in must be on; the Python target only for now); a text field compared with the word itself quotes it (code='me').
sort text The fixed order: field:asc or field:desc, comma-separated (priority:desc, start:asc). Left out, the latest added first. createdAt and updatedAt name when a row was made and last changed, which every table keeps, unless the entity has a field of that name.
sortable text Fields a caller may sort by, comma-separated. Adds a sort param: start, or -start for the largest first. createdAt and updatedAt may be named, as in sort.
paging none page cursor none page adds page and size and X-Total-Count. cursor adds cursor and size and sends X-Next-Cursor.
pageSize number 20 Rows a page holds when the caller does not say.
maxPageSize number 100 The largest size; more is a 400.
searchIn text The fields the q, query or search param looks in, comma-separated. Left out, the entity's Search fields, else its text fields.
total boolean on for page, off for cursor Whether X-Total-Count is sent.
allow role or anyone The lowest role that may run it.
allowIn tenant role With tenants on: the lowest role in the current organisation that may run it. A request for it must say which organisation.
limit <n>/<unit> or none the limits section's default How many requests one caller may make in a window: 10/minute, 30/hour; the unit is second, minute, hour or day. none leaves it unlimited whatever the default. See Rate limits.
limitBy principal tenant ip the limits section's by, else principal Who a caller is for the count: the person or key signed in, the organisation, or the address.
scope text With managed API keys: the scope a key must hold to call it, like jobs:read. Not an entity's scope, which is tenants'.
description text One sentence for the engineer, the agent and the OpenAPI summary.

A where field must be a string, text, enum, int, float, boolean, uuid, date, datetime or decimal of the entity, and an enum's value one of its values; a comparison (>, <) is for numbers, dates and text. A param named for one of the entity's fields also filters the list by it (equal); a param's filter says another way, below. Slots: params (Param), refuses (Refusal).

A cursor is opaque text: send the last answer's X-Next-Cursor as cursor. It holds the order it was read in and the last row's values, so it stays right while rows are added; one for another order, or not one the list gave, is a 400 naming cursor. The rows are ordered by the fields named and then by the key, so the order is total. Rows with no value in a field ordered by are skipped or repeated at a cursor's edge: lint warns (cursor-sort-nullable).

A list that is not paged (paging: none, or no query words at all, a bare list) is cut at GLOBETROTTER_LIST_DEFAULT rows and answers X-Truncated: true exactly when more rows matched than it sent, never when exactly that many exist. So does a page's Data holding a list of the entity's rows ({ "tasks": [...] }), and a command that answers that Data again. The body is the same either way; the header is in the contract for those operations. A cached query answers without it.

A query param whose field names a single relation (not a many one) keeps the rows whose link is that key: ?assignee=<id>. Its filter is eq, in (with many: ?assignees=<id>,<id>) or isNull (a boolean; not on a relation that is always set). The param is read as the type of the other entity's key: a value that is not one is a 400, assignee should be an id, like 0b8f6c1e-2d4a-4f7b-9c3e-5a1d7e9f2b46. A key no row has is an empty list, never a 404. Any other filter on a link, or a relation that holds many, is a lint error (filter-type, filter-invalid: use has for many).

A query's fixed where may name a single relation too, by its name or <name>Id: assignee=<key>, assignee!=<key>, assignee=null, assignee!=null. !=<key> leaves out the rows with no link, as SQL does. It may name a row time where the entity has no field of that name: updatedAt>=2026-06-01T00:00:00Z, compared as an instant. Lint where-invalid refuses the rest: a many relation, < or > on a link, a value that is not a key of the other entity, =null on a relation that is always set, =null on a row time.

A where across a relation, and on now

A fixed where may name a field of the row a single relation points at, with a dot: item.category=camping, member.email=ada@example.com, through more than one hop (item.owner.name=Ada). The rest of the part reads on that entity as it would on this one (its types, an enum's values, =null). It is an exists on the relation (EXISTS (SELECT 1 FROM item WHERE ...)), the same on sqlite, Postgres and MySQL. A relation that holds many is not crossed (has in a query param is for those).

today and now compare a date or a time with the moment of the request, worked out on each request, never when the file was written: due<today on a date (today's date, in UTC); <today and >=today on a date and time are from the day's start (UTC); seen>now on a date and time is the instant. On a text or an enum the word is a word. A now on a date is refused (where-invalid: use today). So "Loans out" is returned=false, "Overdue" is returned=false, due<today, and "camping out" is returned=false, item.category=camping. A Shape's where reads the same words, so a count of those rows is a Shape from Loan with agg: count and the same where. Each is a feature a target must say it writes (where-path, where-now): Python and Rust both do; a target that did not would have target-unsupported name the operation and its list answer 501.

Command

An operation that changes something.

Prop Type Default What it does
name name The command's name, like archive.
entity ref Entity The entity it writes. One store per command.
does create update delete restore transition custom custom A command added with a name that reads as one (add, create, new: create; update, edit; delete, remove; restore, undelete, each alone or with the entity's name) in a service about one entity gets it and the entity, in the studio and in add_operation. The first four are generated whole from the entity. restore brings back a soft-deleted row. transition makes one move of the entity's state machine. custom is yours. A create or an update reads its input by the rules below.
transition ref Transition With does: transition: the move it makes. It must be a move of the command's own entity.
sets text For an update: field=value pairs, comma-separated (archived=true).
returns ref Entity or Shape What it answers. Empty behind a page action: that page's data. A Shape is answered as it is, not wrapped, and is yours to write: Shape.
says name The key of a sentence it answers, like confirmation, instead of the page's data.
many boolean false It answers a list.
emits event An event written in the same transaction; flows listening for it run after.
allow role or anyone The lowest role that may run it.
allowIn tenant role With tenants on: the lowest role in the current organisation that may run it.
grants tenant role On a create of the organisation itself: the asker becomes its member with this role, in the same transaction.
idempotent boolean false On: it takes an Idempotency-Key header, and a repeat of a key answers what the first answered. See Idempotency keys.
keepFor number 86400 With idempotent: the seconds a key is remembered, from 60 (a minute) to 2592000 (30 days).
limit <n>/<unit> or none the limits section's default How many requests one caller may make in a window: 10/minute, 30/hour; the unit is second, minute, hour or day. none leaves it unlimited whatever the default. See Rate limits.
limitBy principal tenant ip the limits section's by, else principal Who a caller is for the count: the person or key signed in, the organisation, or the address.
scope text With managed API keys: the scope a key must hold to run it, like jobs:read. Not an entity's scope, which is tenants'.
description text One sentence of what happens when it runs.

Slots: params (Param), refuses (Refusal).

What a create and an update read

A generated create and update hold each value to its field's rules. The contract says the same rules, so a client can check before it sends.

Rule What happens
A param fills a field of the same name It carries the field's rules, on a create and on an update alike. An update's param is as optional as it says. One added to an update from now on (the studio's + Param, add_operation) other than the row's key comes in optional unless you say required (a PATCH: only what is sent changes, so a row's done toggle sending {id, done} is not refused for the title it left out); one already in the design stays as it was, so switch Required off for a partial update there. An optional param left out changes nothing, and only what is sent is checked.
A param and its field both say a rule The stricter holds: the higher min, the lower max; an enum offers only the values both list; text keeps the param's lengths beside the field's pattern. A decimal takes no minus when either says a min of 0 or more.
A blank optional value with a shape Not given (Value types). On an update the field is left as it was, never set back to its default. A required field sent blank is a 400. The contract allows "" only where the param is optional, and a page's stub leaves a blank optional date out.
A body with more than one thing wrong One 400 names every refused field in fields, under its JSON name (dueOn), the same body from both targets. A create fed by a page's form (no params) names the form's fields as draft.<field>. Transcript
An update's param says clears and is sent null The field is emptied, and the audit keeps it as any change. Left out, the field stays; sent blank, a shaped field stays (blank is not given): null is the one way to empty it. The field must be one a row may leave empty (required: false, not the key); the contract types the param [<type>, "null"]. A param named for a single relation (assigneeId or assignee) empties the link the same way, unless the relation is always set: left out, the link stays; a key no row has is the 404; a blank is a 400 (assigneeId should be an id.), since an id has no blank form. A generated body empties the link only: a text field your code writes from it (a shown name) stays until your body changes it. null on any other param is a 400 on both targets: name may be left out, but not sent as null.
A create takes its key, a unique field, or every field of a unique index from the caller A row that already has the value answers 409, the service word rowExists: A {entity} with that {key} is already there. Several such values are joined with Or:. It is the answer too when the store itself refuses the insert: a removed row still holding the value, or two creates at once. The contract lists the 409 on exactly those creates.
A create or an update sets a link (assigneeId) The row it points at is looked up first. None there: 404, No technician has that id., on both targets, never the database's refusal. A link left out of an update is not looked up.
A value that is not a number or not a decimal 400: price input should be a valid decimal. (input should be a valid number for a float). A design cannot reword these two.

A param that says clears may also be required (fieldops' Work.assign): it must be sent, as a key or as null, and left out is the 400 Assignee is missing. Lint warns (create-key-mixed) when a create may be sent with or without a key the store also makes.

What a delete refuses

A generated delete of a row that other rows still point at answers 409 before it deletes, and the contract lists that 409 with an example:

$ curl -i -X POST http://localhost:8974/teams/actions/delete/01a1d743-…
HTTP/1.1 409 Conflict
{"error":"This team still has members: remove or move them first."}
Rule What happens
Which rows count Rows held by a relation whose onDelete is restrict (the default), in the same store: a many relation of this entity (a job's tasks), or a single relation another entity holds to it (a booking's room).
What does not A joined relation (the join table has its own refusal), a relation across stores (no foreign key), and a soft-deleted entity (its delete keeps the row).
The words The service word stillHas: This {entity} still has {what}: remove or move them first. {what} is the many relation's name, else the holder's plural.
A delete in a body of yours that does not ask first The database's foreign key refuses it: 409, Other rows still point at this one: remove or move them first.

Run on SQLite on both targets (python-still-has.txt, rust-update-links.txt), and on fieldops' Technicians.remove on Python; see Limits.

Idempotency keys

What it is for, with pictures: Concepts. What has been run on which target and engine: Targets.

A Command with idempotent: true takes the header. The first answer's status and body are kept in a table idempotency_key, in the store of the entity the command writes (postgres, sqlite or mysql, with migrations; sync writes the migration). A key is one operation's and one caller's: the row is keyed by the operation (Service.op), the organisation and the caller's id (- where there is none), and the key. keepFor (seconds, 60 to 2592000, a day when left out) is how long it is kept; keepFor without idempotent is refused when the file is read.

Header Where What it is
Idempotency-Key The request of an idempotent Command. Optional: without it the request runs as any other. 1 to 255 printable ASCII characters, no space first or last.
Idempotent-Replayed The answer to a repeat. Absent on the first answer. true
Retry-After The 409 below. 1

What such a command answers that others do not:

Status When Message
The first answer's status and body, with Idempotent-Replayed: true The key was used for this same request. Nothing runs: no write, no audit row, no event. On a versioned row the first answer's ETag is sent again. The first answer's
400 The key is empty, longer than 255, or holds a character outside printable ASCII. keyBad: Idempotency-Key is 1 to 255 printable characters., with field: "Idempotency-Key"
409, Retry-After: 1 The first request with the key is still running after a wait of 5 seconds. keyRunning: The first request with this Idempotency-Key is still running: try again.
503, Retry-After: 1 On sqlite only: another write held the database for the 5 seconds, so the key could not be taken. Nothing ran. storeBusy: The service was busy with another write and could not take this request: send it again with the same Idempotency-Key.
422 The key was used for a different request: another body or other path params. keyReused: This Idempotency-Key was used for a different request.

"The same request" is the SHA-256 of the operation, the path params and the body, each as canonical JSON; both targets make the same hash. A request that is refused or fails keeps no key. A key past keepFor is forgotten, and expired rows are deleted at most once an hour by each process. Browsers on another origin may send the header and read Idempotent-Replayed once CORS names them.

Rate limits

What it is for, with pictures: Concepts. What has been run on which target and engine: Targets.

The design's limits section, beside auth:

Key Type Default What it does
default <n>/<unit> The limit of every Query and Command that says none. Left out, only operations with their own limit are limited.
by principal tenant ip principal Who a caller is, for operations that say no limitBy.
store ref Store A redis store the counts are kept in, so every process counts together. Left out, each process counts its own in memory (at most 10,000 keys).
signIn <n>/<unit> 5/minute Failed password sign-ins from one address for one email, where the design has session or jwt sign-in. It cannot be turned off here.

Only Queries and Commands are limited: not webhooks, flows, jobs or the sign-in paths. The window is fixed: second, minute, hour or day, counted from the clock (floor(now / window)). A request is counted after sign-in, allow and the organisation are checked and before its body is read (the order). A repeat answered from an idempotency key is counted.

Who (limitBy) Counted as
principal The person's id; a key's id under an API key; the address for a request that is not signed in.
tenant The organisation the request is for. With none, as principal.
ip The connection's address: behind a proxy, the proxy's.

One over answers:

Status Header Message
429 Retry-After: the seconds until the window ends, 1 or more tooMany: Too many requests: try again in {n} seconds.

The count's key in the store is <app>:limit:<Service.op>:<by>:<who>:<window>. A store that cannot be reached lets the request through, with a warning logged at most once a minute and, with metrics on, limits_store_errors_total. GLOBETROTTER_LIMITS=off turns every operation's check off and leaves the sign-in limit on; the generated contract tests set it.

The sign-in limit (signIn) is in Auth and security. Its 429 is in the contract only when limits.signIn is written.

API keys

What it is for, with pictures: Concepts. What has been run on which target and engine: Targets.

The settings of the apikey sign-in method (Sign-in settings):

Setting Default What it does
keys managed: the service keeps its own keys, in a table api_key in the first SQL store with migrations. Left out, a key is whatever the wiring's key store knows.
prefix the app name's letters, up to 8; gt under 2 2 to 8 lower-case letters every key starts with.
make the highest role The lowest role that may make, rotate and revoke keys.
scopes The scopes a key can be given, each word:word like jobs:read.
expiresIn 7776000 (90 days) The seconds a key lives, and the most a maker may ask for. 0 is never (lint warns); otherwise 60 or more. A create may ask for 0 only when the design's is 0.
graceFor 86400 (a day) The seconds a rotated key keeps working beside the new one. The new key lives as long as the old one was made to (at most the design's expiresIn), at the lower of the old key's role and its maker's sign-in role now. A rotation is never refused for the role.

A key is <prefix>_<id>_<secret>: the id 16 hex characters, the secret 43 of base64url. It is answered once, when made or rotated. The service stores the SHA-256 of the whole key and its last four characters (hint).

  • A key acts as its maker: the principal is the maker's id, the role the maker's or one below.
  • A key with scopes runs only the operations whose scope it holds; an operation with no scope is refused to it (keyUnscoped). A key with no scopes is held to its role alone.
  • A key cannot make, rotate or revoke keys.
  • A key of another shape goes to the wiring's key store, which under managed keys answers only when GLOBETROTTER_ENV is exactly local.
Path Answers
GET /apikeys The asker's keys: id, name, role, scopes, hint, the dates. Never the key.
POST /apikeys/actions/create 201 and the key, this once. Body: name (required), role, scopes, expiresIn.
POST /apikeys/{id}/actions/rotate 201 and a new key; the old one works for graceFor more.
POST /apikeys/{id}/actions/revoke 204. A second revoke answers the same.
Status When Message
401 The key is not one the service knows, or its secret is wrong. keyUnknown: That API key is not one this service knows (sent in {what}).
401 The key's role is no longer on the ladder. keyRoleGone: That API key's role, {what}, is not one of {values}.
401 The key is past its expiresAt. keyExpired: This key has expired.
401 The key was revoked. keyRevoked: This key was revoked.
403 The key does not hold the operation's scope. keyNoScope: This key does not have {what}.
403 The key has scopes, and the operation names none. keyUnscoped: This key is limited to its scopes, and {what} names none of them: call it signed in, or with a key that has no scopes.
403 The request names an organisation other than the key's. keyElsewhere: This key works only in the organisation it was made in.
403 A key calls one of the /apikeys paths. keyCannotMake: A key cannot make, rotate or revoke keys: sign in as a person.
403 The asker is below make. keyBelowMake: Signed in, but below {what}.
404 The id is not a key of the asker's. keyNotYours: No key of yours has that id.
409 A rotate of a key already rotated or revoked. keyGone: This key was rotated or revoked already.
400 A create asks for a scope the design does not list. notOneOf, with field: "scopes": scopes should be 'jobs:read' or 'jobs:write'.
400 A create asks for a life under 60 seconds, or over the design's expiresIn. atLeastN or atMostN, with field: "expiresIn": expiresIn should be 7776000 or less.
422 A create asks for a role above the maker's sign-in role. keyAbove: A key cannot be given more than its maker has.

An audit_log has a column operation (an older project's once its migration is applied): what wrote the row (Audit). With managed keys and anything audited, the engine gives audit_log a column via (apikey:<id> for a change made under a key, empty otherwise) and keeps a row for each key made, rotated or revoked, as entity apiKey (name, role, scopes, hint, expiresAt, revokedAt, rotatedTo; never the key or its hash). An entity of the design may not be named apiKey or api_key while keys are managed: the file is refused when read.

With tenants on, a key belongs to the organisation it was made in (api_key.tenant), and the four paths take the organisation as any operation does; a key that names none runs in its own, and one naming another is the 403 keyElsewhere. A key's role is on the sign-in ladder, checked at make time. In its organisation a key acts at its maker's role there now, and at the lower of that and its own role only when its role's name is also one of tenancy.roles: lowering the maker lowers their keys at once, raising the maker raises them up to the key's own role where the ladders share it, and a maker no longer in the organisation is the tenant step's 404 (notMember) (Auth and security). lastUsedAt is written after the answer, at most once a minute per key per process; a refused request need not record a use. The contract marks the paths x-globetrotter.auth: "apikeys" and a scoped operation x-globetrotter.scope.

Param

One value an operation takes.

Prop Type Default What it does
name name The param's name, like id.
type value type string Its type.
required boolean true The caller must send it. A param added for a field of the entity its command writes takes the field's: from an optional field it is optional.
in body query path header body In the JSON body, after ?, or part of the URL. header is for a client's call only: lint refuses it on an operation.
values text For an enum: its choices, comma-separated.
finds ref Entity The entity whose key it is. None having it answers 404, "No product has that id."
message text What the caller is told when it breaks a rule.
min number Shortest text or smallest number.
max number Longest text or largest number.
many boolean false A list of values: a JSON array in a body; after ? separated by commas (?status=Open,Done).
filter eq gt gte lt lte in contains startsWith isNull has eq On a query's param: how it keeps rows. in takes a list (many); contains and startsWith are for text and ignore case; isNull takes true (rows with no value) or false; has is about a relation that holds many (joined, or one to many) and keeps the rows linked to the one whose key the param holds (?tag=<id>; the param is of the other entity's key type).
field field name the param's name The entity field it keeps rows by: startsAfter and startsBefore may both be about start. It may name a single relation instead (assignee or assigneeId): see a list kept by a link.
clears boolean false On an update's param: sent as JSON null, it empties the field it fills, or the single relation it is named for. See What a create and an update read.

Refusal

A way to say no that params, keys and roles do not already cover.

Prop Type Default What it does
name name The refusal's name, like nothingToUndo.
status 409 410 422 423 429 503 409 Not now; gone for good; cannot be done; locked; too many; try later.
message text The words the caller sees.

A status of 400, 401, 403 or 404 is refused for a Refusal: those come from params, keys and roles. Write the status as text ("409").

Machine

Which moves an enum field may make. Slot of Entity: machines. Each holds transitions (Transition). Both targets write it. A status that only moves by transitions cannot be set to a state it may not reach, whoever asks.

Prop Type Default What it does
name name The machine's name, like fulfilment.
field text The enum field of its entity it moves, like status. Its values are the states. One machine moves a field.
initial text the field's default The state a new row starts at.
final text States with no way out, comma-separated (Delivered, Cancelled). A state with no way out that is not listed is flagged machine-dead-end.

A command that creates a row cannot take the field (machine-create-sets): a new row starts at the initial state. The repository's update refuses a value for the field, so code that writes the state around the machine fails when it runs (Python: ValueError("status is moved by the fulfilment machine: use a transition") unless the call says _machine="fulfilment"; Rust: a 500 from update, with update_moving for the transition's own write). Lint says the same earlier, as machine-direct-write, for a generated update that sets the field.

Transition

One move of a machine. Slot of Machine: transitions. A Command runs it with does: transition and transition: <its id>; the state-machine block (use_service_block) writes a command for every move none runs.

Prop Type Default What it does
name name The move's name, like ship.
from text The states it may be made from, comma-separated (Paid, Packed).
to text The state it moves the row to.
allow role A role the asker must have as well as the command's own allow: the higher of the two decides. A role below it is told so (403), before anything else about the row is said.
when text A guard on the row's own fields: address != null, total >= 10 and not gift. = != < <= > >=, and or not, + - *, null, true, false, numbers and quoted words.
message text What a failed guard says. Left out: An order cannot be shipped yet: address != null is not true.
emits event An event written in the same transaction as the move, with the row's fields as its data. The command's own emits, if it has one, is written instead. Read by flow-orphan.

What the command answers, in this order: a role below the move's (403, or 401 for no one); the row not there (404); the row in a state it cannot be moved from (409, An order that is Delivered cannot be shipped; it must be Paid or Packed.); the guard not true (422, the move's message); else the row moved, answered as the command's returns says. On a versioned entity an If-Match that is not the row's version is a 412, after the 404 and before the 409. The 409's message is notFromState ({entity} that is {state} cannot be {verb}; it must be {values}.), which you may set in the design's words; {verb} is the move's name as a past word (shipped; the state it goes to when that reads as the same word). The write itself is conditional on the row still being in one of the from states, so of several requests moving one row at once exactly one is made and the others get the 409 for the state the row is in now (Limits). Which parts of a guard go into that write, and which are checked on the row as read: Limits. The contract lists each answer on the operation, and x-globetrotter.transition names the move.

A guard reads the row's own fields only: not a path across a relation, a link column, or a date, a time, an id or json. Arithmetic needs values that are there (compare a field that may be empty with null first), and two fields that may both be empty are not compared with each other (make one required), does not mix a float with a decimal, and has no division (whole numbers divide as whole numbers in one language and not another). A guard that does not read is machine-guard-invalid, and its command answers 501 until it does, never a move without it.

Changing an enum's values writes a migration: on postgres the field's CHECK is dropped and made again; on mysql the file carries a recipe in comments and a NOTE, since mysql names the check itself (<table>_chk_<n>); sqlite rebuilds the table in the migration (a new table with the new check, the rows copied, the old one dropped and the new one renamed, its indexes made again) unless something else points at it, in which case it is a recipe too (see Limits). A state taken away is marked DESTRUCTIVE: a row still in it stops the migration.

A page reads a named Query

A page's list is the Query named list of the service at its route unless the page says another: reads: "Loans.overdue" on the page (design side; MCP set_page_reads; the studio's page inspector, Reads). The Query must list rows (many) or answer a Shape, and take no key in its path. The contract then serves the page's data at that Query's own path (/loans/overdue), the binding stub fetches there, contract-drift checks the page's fields against that Query's rows, and propose_operations asks for no list the page does not read. show_count(design, page, nodeId, query, part?) binds a StatTile to a Shape's count Part and sets reads in one call (lint tile-sample-number offers it on a tile still showing a template number). show_count also takes an entity (the count of its rows, where no Shape is). A list's late dates stop for the yes/no field its row's box edits, else the one finished-like boolean its name says, else the page's own doneField (a field name, or none; MCP set_page_done_field; get_page and explain_node say which was chosen). remove_service_node takes withUses on an entity: with its own service, the pages at its route and their navigation links, in one step ("preview" says what would go), and the checks (check_auth, check_audit, the checks that drive the app) take as, the role to run as. A conditional unique's or a no-overlap's 409 carries x-globetrotter.uniqueFields in the contract: a form says its message under those inputs.

Shape

A typed answer that is not a row of an entity. Section: shapes. Each holds parts (Part). A Query or a Command names one in returns. With a from, the backend works it out (group, count, sum, join across single relations) in one SQL statement; with none it is a typed answer for code you write, which is no longer an untyped one. Both targets write it: a closed object in the contract, a Pydantic model or a serde struct, and, for a shape worked out from rows, the query and the body.

Prop Type Default What it does
name name The shape's name, like JobCounts. It is the contract's schema (JobCounts; JobCountsShape when an entity or a page's data has the name).
from ref Entity The entity whose rows it counts, sums or reads, in a SQL store. Left out, the answer is yours to write (501 until you do).
where text What a row must have to count, as a Query's where: qty>0, status=Open, returned=false, due<today (today and now, and a field across a relation: A where across a relation). "Items out: 12" is a count Part of a Shape from Loan with where: returned=false.
groupBy text Fields or paths across single relations (room.name), comma-separated: a row for each different value, ordered by them.
description text The schema's description.

Slot: parts (Part).

Part

One value in a shape's answer.

Prop Type Default What it does
name name The key in the answer.
type a value type what it reads What it answers. Left out: a count is int, a sum is as its numbers are, a column is its field's type. decimal travels as text. A type that reads wider is allowed (a whole number as a decimal); one that contradicts what it reads is part-type-mismatch.
values text the field's For an enum: its choices.
required boolean yes, but see below Whether the answer always has it.
source text the part's name The field it reads as it is, or a path across single relations: room.name, product.category.name. A <relation>Id is the link's value.
agg count sum avg min max countDistinct Works a value out of many rows.
of expression What sum, avg, min, max and countDistinct work on: a field, a path, or a calculation over fields. count takes none.
shape ref Entity or Shape In a shape with no from: an entity's row, or another shape, held here (with many, a list of them). Its value is yours to write.
many boolean false A list. Only with shape.
description text The property's description.

A part is a column (source, or nothing but its name), a worked-out value (agg), or, with no from, a value of your own (type, or shape).

Expressions (of) are numbers, field names and paths across single relations, + - * / and parentheses: qty * product.price. / is never whole division (qty / 2 of 3 is 1.5). The same language, with = != < <= > >=, and, or, not, null, true, false and quoted words, is read for guards; a shape reads only the arithmetic. A path crosses relations that point at one row, in one store; it is a left join, so a row with no link is still counted (its value is empty: a sum leaves it out, a group of them has no key).

What each worked-out value is. count and countDistinct: a whole number, 0 for no rows. sum: of numbers, as numbers are; of no rows, 0. avg: a decimal (a float of floats). min and max: of numbers, dates, datetimes or text, as the field is. An average, a least or a most of no rows (or of values that are all empty) has no answer: its required is then false and the answer leaves it out (required: true on one that can find nothing is part-agg-empty, an error). A column read through an optional link is left out the same way. A decimal sum is read back at four places, as a decimal field is. A shape with groupBy answers a row for each group, ordered by the group fields; one with no groupBy and a worked-out value answers one row of totals; one with only columns answers a row for each row (oldest first).

{ "id": "revenue", "type": "Shape", "props": { "name": "Revenue", "from": "line", "where": "qty>0" },
  "slots": { "parts": [
    { "id": "rv-total", "type": "Part", "props": { "name": "total", "type": "decimal", "agg": "sum", "of": "qty * product.price" } },
    { "id": "rv-lines", "type": "Part", "props": { "name": "lines", "agg": "count" } } ] } }

answers {"total": "216.4800", "lines": 4}; with no rows, {"total": "0.0000", "lines": 0}.

A query that returns a shape with a from is written whole, as the pages' data at a route is not: put it at a route of its own (/reports/counts, not the list at /reports, where a page reads its data: lint shape-at-page-route). Its params are not read (put what it keeps in where). A shape of a design with sign-in on keeps an entity's owner: in a request, a report counts only the asker's own rows, as a list does; the highest role counts them all. A sensitive field is never in a shape.

Flow

Work that follows an event. Section: flows.

Prop Type Default What it does
name name The flow's name, like archiveCleanup.
on event The event that starts it.
durability inline worker durable worker inline: in the same process after the commit. worker: on a worker, retried. durable: survives a restart mid-flow.

A components file may lower a flow's durability for an environment, never raise it. Slot: steps (Step, at least one).

Step

One function a flow runs.

Prop Type Default What it does
name name The step's name, like notifyOwner.
retry number 0 to 20 0 How many more times it is tried after a failure.
timeout number, 1 or more 30 Seconds it may run.
description text What it does.

Job

Work started by a schedule or by your code. Section: jobs.

Prop Type Default What it does
name name The job's name, like sendDigest.
durability inline worker durable worker As for a flow.
retry number 0 to 20 0 Retries after a failure.
timeout whole number, 1 to 86,400 300 Seconds one try may run, as a step's timeout: a try past it is cut (took longer than 5 s), and a run still running ten seconds after it is marked abandoned. Both targets read it.
description text What it does.

Schedule

When a job runs by the clock. Section: jobs.

Prop Type Default What it does
name name The schedule's name, like nightly.
cron text A cron expression, UTC: 0 3 * * *.
job ref Job The job it starts.

Cache

Keeps a query's answer for a while. Section: caches.

Prop Type Default What it does
name name The cache's name.
store ref Store Where it is kept: redis, or memory on a laptop.
query ref Query The query whose answers it keeps.
ttl number, 1 or more 60 Seconds to keep an answer.

File

Uploads and downloads. Section: files.

Prop Type Default What it does
name name The file storage's name.
maxSize number, 1 or more 10 The largest upload, in MB.
types text Accepted kinds, comma-separated (image/png); empty takes any.
signed boolean true Downloads go through links that expire.
backend local or s3 local Where the bytes are kept: a folder on the backend's disk, or a bucket (AWS, MinIO, R2).

A File with backend: s3 is in the bucket each environment names, in its components file's block (never in the design; the key and secret are names read from the environment, as everywhere):

"files": { "jobPhotos": { "bucket": "acme-photos", "prefix": "app/", "endpoint": "https://s3.eu-west-1.amazonaws.com", "region": "eu-west-1", "accessKey": "{secret:S3_KEY}", "secretKey": "{secret:S3_SECRET}" } }

bucket is required. prefix, endpoint (a plain web address, for MinIO or R2; http:// is allowed for a laptop) and region (else AWS_REGION, else us-east-1) are not. Without accessKey and secretKey the backend reads AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY; outside local one of the two is required, and the backend refuses to start without it, in one sentence. A block may also say "backend": "local", so a laptop keeps the files on disk while production keeps them in the bucket (the reverse is refused: the contract changes with the design). Objects are <prefix>/<name>/<id> and <prefix>/<name>/<id>.json, the same in both targets, so a file one target kept the other serves.

Uploads still go through the service, so the size and the type are checked as before. A download checks the service's own link as before, then answers 302 with Location set to a link to the bucket that works for 60 seconds (never kept in a cache). The contract lists that 302 on GET /files/{name}/{id} for an s3 File, beside the 200 an environment on disk answers. Python reads it through obstore; Rust through the object_store crate behind the cargo feature files-s3, on by default when a File is in a bucket.

Finds rows by their words. Section: searches.

Prop Type Default What it does
name name The search's name.
entity ref Entity The entity it searches.
fields text The fields it reads, comma-separated.

Notify

Sends a message. Section: notifications.

Prop Type Default What it does
name name The notice's name.
channel email sms push webhook email How it goes.
from text The sender as people see it.
subject text An email's subject; {field} marks where a value goes.
template text The message, with {field} where a value goes.

Client

An outside service the backend calls over HTTP. Section: clients. Each holds calls (Call). Both targets write it: a typed method per call, a timeout on every try, retries with backoff only where repeating is safe, a circuit breaker, the request's id passed on, the key read from the environment, and a fake for tests. How to call it: Your code.

Prop Type Default What it does
name name The client's name, like Payments. Its address in a components file is under this name.
auth none bearer header basic none No key; Authorization: Bearer <key>; the key in the header named by header; Authorization: Basic from a key written user:password.
key secret The key, as {secret:NAME}: its value is read from the variable NAME where the backend runs. Outside local the backend does not start without it; in local a placeholder goes out and a warning names the variable.
header text For header auth: the header the key goes in, like X-Api-Key.
timeout number 1 to 600 10 Seconds one try waits for an answer, connecting and reading.
retries number 0 to 10 2 Tries again after a 5xx, a 429, a timeout or a broken connection, for a call that is safe to repeat. 0 never.
backoff number, 0 or more 200 Milliseconds before the first retry, doubled each try, with jitter (half to all of it). A 429 or 503 that carries a Retry-After in whole seconds is waited for exactly that long instead (Limits).
breakAfter number, 1 or more 5 Failed tries in a row before the breaker opens.
breakFor number, 1 or more 30 Seconds it stays open; then one try goes through, and its answer closes it or opens it again.
description text What the outside service is.

Where it is lives in the environment, not the design: GLOBETROTTER_<NAME>_URL (GLOBETROTTER_PAYMENTS_URL), else the components file's block

"clients": { "Payments": { "baseUrl": "https://api.pay.example.com" } }

baseUrl is a plain web address: no user or password in it, no ?query. Outside local a client with neither stops the backend starting, and Status says Payments needs clients.Payments.baseUrl in components.staging.json.

Call

One request to an outside service. Slot: params (Param).

Prop Type Default What it does
name name The call's name, like charge. A method of the client.
method GET POST PUT PATCH DELETE GET The HTTP method.
path text / Joined to the base URL, with {name} where a path param goes: /v1/charges/{id}. A path param's value is percent-encoded. No ? part: query params are params.
idempotent boolean by method Safe to repeat. Left out, GET, PUT and DELETE are and POST and PATCH are not. A POST or PATCH marked true sends an Idempotency-Key header (one value for every try, or the one you pass) and is retried; one that is not is never retried.
returns text The Shape (its name or id) the answer is read as: a typed model, its parts the keys the other side sends (it ignores the rest). It has no from; an entity of yours is refused. Left out, the answer is the JSON the other side sent.
description text What the other side does when it is called.

A call's params go where in says: body (a JSON object), query, path or header (x_tenant is sent as X-Tenant). A GET or DELETE sends no body. many is for a body only (a JSON array). The client sets Authorization, Idempotency-Key, X-Request-Id, Content-Type, Accept and, on Python with traces on, traceparent itself; a param may not claim them.

What a call answers: a 2xx is the JSON (or nothing, for a 204). A 4xx is UpstreamRefused (Python) or ClientError::Refused (Rust) carrying the status and the outside words, which the caller of your service never sees: they get a 502, Payments refused the request (402). A 5xx, a 429, a timeout, a broken connection or an open breaker is UpstreamUnavailable or ClientError::Unavailable: a 502, Payments is not answering. Try again in a moment.

Webhook

A path an outside service posts events to (Stripe, GitHub, Slack, a partner). Section: webhooks. Each holds handlers (Handler). Both targets write it. It is in the contract at its own path, not behind sign-in: the signature is the credential. How the events reach your code: Your code.

What every delivery goes through, in this order, before anything of yours runs:

  1. The raw body is read and held to the body cap (a 413 past it; GLOBETROTTER_MAX_BODY).
  2. The signature is checked over those exact bytes, in constant time, and its signed time against tolerance (a 401 that never says which half was wrong).
  3. Only then the JSON is parsed (a 400 for a body that is not JSON, or has no event id).
  4. The event's id is written to the webhook_event table: the same id again is answered 200 {"received": true, "duplicate": true} and runs nothing, across restarts, replicas and both targets on one database.
  5. The first handler whose match fits runs. A failure is a 500 and keeps nothing, so the sender's retry runs it again.
Prop Type Default What it does
name name The webhook's name, like Stripe.
path text /webhooks/<name> Where it answers, lower case, digits and -. It may not be a service's route, nor one the backend answers itself (/health, /session, /files …).
scheme hmac stripe github slack hmac How it is signed. stripe: Stripe-Signature: t=…,v1=… over t.body. github: X-Hub-Signature-256: sha256=… over the body. slack: X-Slack-Signature: v0=… and X-Slack-Request-Timestamp over v0:time:body. A preset fixes its header, algorithm, encoding and where its event id and type are; the props below are read only for hmac.
secret secret {secret:NAME}: the signing secret, read from the variable NAME. Required. Outside local the backend does not start without it (one line naming every missing one, exit 1); in local a development secret (whsec_local_development) stands in and a warning names the variable.
header text For hmac: the header the signature is in. Required for hmac.
algorithm sha256 sha512 sha256 For hmac.
encoding hex base64 hex For hmac: how the signature is written.
prefix text For hmac: what comes before the signature in the header (sha256=): it must be there, and is stripped.
signs body timestamp.body body For hmac: the body alone, or the time, a dot, then the body.
timestampHeader text X-Webhook-Timestamp For hmac with signs: timestamp.body: the header the time (seconds since 1970) is in.
tolerance number, 1 or more 300 Seconds a signed time may be from now, either way. Only for a scheme that signs a time.
eventId text the preset's Where the event's id is: a JSON pointer in the body (/id, /data/object/id) or header:Name. Without one a retry runs twice (lint says so).
eventType text the preset's Where the event's type is, for the handlers' match.
keepFor number, 1 or more 604800 Seconds an event id is remembered (7 days). Older ones are forgotten by a delivery that arrives (at most once an hour in a process).
runsAs text the lowest role The role its handlers run commands as: row rules apply as for that role, and the audit says webhook:<name>.
description text Who posts here.

The webhook_event table (webhook, event_id, received_at, outcome) is written by a migration on the first SQL store that has migrations, when the design has a webhook: add webhook events. Removing the last webhook writes a migration that drops it and says DESTRUCTIVE: drops the webhook event record: events already seen could run again if sent again.

Handler

What one kind of event does. Slot of Webhook: handlers. The first handler whose match fits runs; an event none fits is recorded, acknowledged and ignored.

Prop Type Default What it does
name name The handler's name, like paid.
match text * The event's type, like payment_intent.succeeded; * for any.
calls ref Command A command run as the webhook's role.
args text param=/json/pointer, …: each of the command's params, read from the body (orderId=/data/object/metadata/order_id, amount=/data/object/amount) or a header (header:X-Name). Every required param must be mapped (lint).
description text What it does, in a sentence.
tenantFrom text With tenants on: where the delivery names the organisation the command runs in, a JSON pointer (/data/object/metadata/org) or header:Name. A delivery that names none that is here is acknowledged and nothing is run. A handler without it runs in no organisation: a command on an organisation's rows is refused (lint webhook-handler-tenant).
emits text An event written to the outbox with the delivery's body as its data, like payment.succeeded; flows listening for it run after the commit. Read by flow-orphan.

LLM

A language model the backend calls. Section: llm. No target writes code for it yet: with a target on, lint raises target-unsupported for it (see Limits).

Prop Type Default What it does
name name The model's name.
model text An alias a gateway or components file resolves, like fast. Never a key.
gateway direct litellm bifrost direct The provider's own client, or a gateway that routes and counts cost.
key secret The provider's key, as {secret:NAME}.
output ref Entity The shape of its answer, checked before use.
retries number 0 to 10 2 Retries on failure.
budget number, 0 or more A daily budget in USD; calls stop when spent.
logPrompts boolean false On: traces carry the words asked and answered.

Design-level sections

auth, observability, tenancy, limits and words sit beside the node sections.

Section Holds
auth.types The sign-in methods, one of each kind: session, apikey, oidc, jwt, passkey, magiclink. See Sign-in settings.
auth.roles The roles, lowest first. anyone is not a role.
observability traces, metrics, logs (on or off), exporter, sampling (0 to 1), redact (field names).
tenancy Organisations: people belong to several, with a role in each. See Tenants.
limits Rate limits: default, by, store, signIn. See Rate limits.
words The service's refusals in your words; a key is one of the lines in the Words sheet, or notFromState (what a move from the wrong state says, for a design with a machine), or noTenant and notMember (what a request with no organisation, or one that is not the asker's, is told, for a design with tenants), or staleVersion and needsIfMatch (what a write with an old If-Match, or with none where one is required, is told, for a design with a versioned entity), or keyBad, keyRunning and keyReused (an idempotent command's refusals, with storeBusy), or tooMany (the 429 of a rate limit; {n} is the seconds to wait), or keyExpired, keyRevoked, keyNoScope, keyAbove, keyCannotMake and keyGone (managed API keys). The Words sheet lists each part's words when the design uses the part; in the file they are words.<key>.

observability.exporter is one of console, otlp, logfire, sentry. Both targets write console and otlp. Python sends to OTLP when the exporter is otlp and to the console otherwise; Rust refuses the others in lint.

Tenants

A design with tenancy says that people belong to organisations and each row belongs to one of them. The organisation a request is for is checked against the person's memberships, and the repositories scope every read and write by it, so code that uses them cannot forget.

"tenancy": { "roles": ["viewer", "dispatcher", "owner"], "from": "cookie", "name": "gt_org",
             "userField": "userId", "roleField": "role", "staffSeesAll": false, "rls": false }
Key Values Default Meaning
roles names, lowest first The roles inside an organisation (not auth.roles, which is the person's role everywhere).
from header cookie claim header Where a request names its organisation. The header X-Org (or the header named) is always read first; a cookie or a token's claim is read when it is absent.
name text X-Org, gt_org, org The header, cookie or claim's name.
userField field userId The membership's field holding the principal's id.
roleField field role The membership's enum of exactly roles.
staffSeesAll boolean false The top global role passes any organisation without belonging to it; naming none, it sees every row.
rls boolean false Postgres row-level security as a second guard; see below.

Entities say their scope (above): exactly one is the tenant, one the membership (the user, the role, one required single link to the tenant), and each rows entity has one required single relation to the tenant. Queries and commands say allowIn, the lowest role in the organisation that may run them; allow stays the person's global role (member: anyone signed in). A create of the organisation can say grants: owner.

What a request is told: no organisation named, 400 Say which org: send X-Org.; an organisation that does not exist or that the person is not in, 404 No org has that id. (the same words, so nothing says which); a role below allowIn, 403 Signed in, but below dispatcher in this org. The words are the design's words noTenant and notMember when it sets them. The contract gives each such operation an optional X-Org header and these answers, and two paths: GET /tenancy (the organisations I belong to and the current one) and POST /tenancy/actions/select ({ "org": id }: checks membership, sets the cookie).

What the scope does, in the repositories (both targets, the owner rule beside it: both must hold):

  • get, find, count and a shape's summary read only the current organisation's rows; another's is "not there" (404). update and delete go through get. A search over its rows is kept to the organisation.
  • create fills the link from the scope and ignores one in the body. A generated update never writes it, and the repository refuses an update that would move a row (400). A link to another entity's row of the organisation is looked up through that entity's repository: another organisation's is a 404.
  • A request that names no organisation runs in none: its reads match nothing and its creates are refused. Outside a request (a script, a migration, a job) the scope is off, as the owner's is.
  • The organisation entity's own reads are limited to the asker's memberships.
  • An event carries its organisation ($tenant in the outbox row's data, the CloudEvent's tenant attribute); a flow's step runs in it. An audit row says it in its tenant column (python -m <app>_core.audit --tenant <id>, cargo run -p <app> -- audit --tenant <id>).
  • every=True (Python) and the *_every methods (Rust) ask for every row: check_tenancy finds them, and raw SQL, in your code by file and line.

Row-level security (rls: true, postgres stores only): the migration enables and forces it on each rows table (and only those) with the policy "org_id" = NULLIF(current_setting('app.org', true), '')::uuid, and each unit of work sets app.org first. It guards raw SQL too, but binds no superuser, no BYPASSRLS role and (it can switch the policy off) no owner of a policy table: the API serves as an application role that is none of them, and in production refuses to serve as one, or as one it cannot check. The membership, the organisation, audit_log, API keys, the outbox, the flow tables and join tables have no policy. rls on sqlite or mysql is a lint warning (tenant-rls-engine).

Tenants lint (tenant-…): link-missing, two-links, unscoped-entity (warning), allow-missing, allow-unknown, allow-anyone, store, needs-people, claim-needs-token, unique-global (warning), grants-misplaced, rls-engine (warning), and webhook-handler-tenant. Rust reads the organisation from a header or a cookie; from a token's claim is Python's alone (target-unsupported says so).

What each target emits

Python writes a uv workspace under backend/packages/. Rust writes a crate crates/<app>-generated beside your crate crates/<app>. Python's engines are postgres, sqlite and mysql, over async drivers. Rust's are the same three, each behind a feature of its own.

Primitive Python Rust
Store An async engine per store in <app>_core/db.py, and its migrations. repo_<engine>.rs per engine turned on; redis or memory for a Cache.
Entity, Field A SQLAlchemy entity, a repository, Pydantic models, the field rules. Serde models and the repository, the same rows Python writes.
Relation, Index Foreign keys, indexes, and the overlap trigger or constraint. The same migration files, run by sqlx::migrate!.
Service A router, a Protocol and a Base class, and your stub in <app>_impl. A router, a trait with default methods, and your type in your crate.
Query, Command The route, and a generated method wherever the design says it all. The route and the default methods; the rest answer 501.
Param, Refusal Request parsing, a contract response, an error class. The same, with error.rs in the contract's error shape.
Flow, Step flows.py, a relay, a worker (Taskiq), your steps in flows.py. apalis on the store's database; steps are your functions.
Job, Schedule jobs.py and a scheduler, by cron or by hand. Jobs by cron or by hand on the same queue.
Cache Redis by the store's URL, or memory. The same, sharing Python's on one Redis.
File files.py and routers/files.py: an upload checked for size and kind, a download by a signed link; kept on local disk, or in a bucket through obstore (backend: s3). files.rs: the same links and the same object names; a bucket through object_store, behind the feature files-s3.
Search FTS5 (sqlite), full-text (postgres), LIKE elsewhere. The same.
Notify SMTP, a webhook, or the console. The same.
Client, Call clients.py: httpx, a Protocol, the real client and a fake, and tests/test_clients.py. clients.rs: reqwest behind a Transport, a typed method and arguments per call, a Fake, and tests/clients.rs.
Shape, Part shapes.py (the SQLAlchemy columns, joins and rows each shape reads), a summarise on the repository of its entity, a generated method that validates each row as the contract's model; a shape with no from is async def cart(self, ctx) -> m.CartSummary, yours. A shape_<name> module of SQL per engine, a summarise_<name> method on the entity's repository, a default method that reads each row as the contract's model; a shape with no from is a trait method answering models::CartSummary, yours.
Machine, Transition machines.py (the refusal of a move, the check of its own role), a generated method in services.py for each command that does a transition, the repository's guard on the field, tests/test_transitions.py. machines.rs, a default method in <service>_api.rs, update_moving on the repository, the same refusals, tests/machines.rs.
Webhook, Handler webhooks.py (verify, parse, the record of events seen, delivery() for tests), routers/webhooks.py, tests/test_webhooks.py. The record and the handler's effects share one transaction. webhooks.rs (the same, through hmac's constant-time check) and tests/webhooks.rs. The record is claimed, then finished: see Limits.
Entity versioned versions.py (reads If-Match, the 412), the column on the entity as SQLAlchemy's version_id_col, _version on the repository's update, delete and restore, ctx.if_match, the ETag on the route, tests/test_versions.py. src/version.rs (the IfMatch extractor, the tag held in a task-local while the body runs, the 412 and the 428, tagged for the ETag), version raised in the statement of the repository's update, delete and restore and held there by AND version = <tag>, a transition's update_when the same, If-Match and ETag in the CORS headers, tests/versions.rs.
Command idempotent <app>_core/idempotency.py (the key read, the key taken as the first statement of the unit of work, the answer kept in it), the wrapper round the route, the 409 in errors.py, tests/test_idempotency.py. Your handler's signature does not change. src/idempotency.rs (the key kept in a task-local while your body runs; the first unit of work the body opens on the command's store claims it; the answer is kept after the body's commit), tests/idempotency.rs. Your handler's signature does not change.
limit, the limits section <app>_fastapi/limits.py (the limited operations, the counter in Redis or memory, the route dependency after the role check), ratelimit.py counting failed sign-ins through the same counter, tests/test_limits.py. src/limits.rs (the same, as a layer inside the route's sign-in check), the redis crate when a store is named, tests/limits.rs.
Managed API keys, scope apikeys.py (the table, the key's hash, make, rotate and revoke, the scope an operation needs), routers/apikeys.py, tests/test_apikeys.py. apikeys.rs, the same paths and checks, tests/apikeys.rs.
LLM Refused: lint target-unsupported. Refused: lint target-unsupported.

Where a target cannot write a node, lint raises target-unsupported naming the target and the node, and the generated backend would lack it. Rust does not write sign-in by passkey, a non-inline flow on a mysql store, or the logfire and sentry exporters, an organisation read from a token's claim, or a store that is not sqlite, postgres, mysql, redis or memory. Python writes every node type but an LLM and accepts every section. Its drivers are the three above, so a mongodb or duckdb store is not one it can run; lint does not say so for Python. The table per section is in Targets.

Routes

One rule, never a renamed REST shape:

Operation Method and path
Query named list GET {route} ({route}/{p} per path param)
Query named get, with a path param GET {route}/{id}
Any other Query GET {route}/{name}
Command POST {route}/actions/{name} (/{p} per path param)

A path param adds /{name} to the path, in order. Only GET and POST exist. Other paths the contract holds:

Path When
GET /session, POST /session/actions/signIn, POST /session/actions/signOut session sign-in
POST /token/actions/issue jwt sign-in
POST /magiclink/actions/send, POST /magiclink/actions/redeem magiclink sign-in
POST /passkey/actions/registerOptions, register, signInOptions, signIn passkey sign-in
POST /files/{name}, GET /files/{name}/{id} A File; the GET answers 302 to the bucket for a File with backend: s3
GET /tenancy, POST /tenancy/actions/select Tenants: the asker's organisations and roles; choosing one sets the cookie
GET /apikeys, POST /apikeys/actions/create, POST /apikeys/{id}/actions/rotate, POST /apikeys/{id}/actions/revoke Managed API keys
GET /search/{name}?q= A Search
POST {path} (default /webhooks/{name}) A Webhook; security: [], tag Webhooks, x-globetrotter.webhook, the signature header as a required parameter; answers 200, 400, 401, 413, 500
GET /health, GET /ready Always; not in the contract
GET /openapi.json, /docs The contract; /docs only in local

What an operation answers:

  • At a page's own GET, that page's data. A command under a page's route answers that page's data too, as the pages' useApi().post expects.
  • A command with returns answers { "<entity>": Entity }, or { "<entities>": [...] } with many. A command with says adds { "<says>": "…" }.
  • A create with no page at its route and no returns answers the row it made.
  • A Query with returns and no page answers the row, or an array of rows.
  • A list with paging: page (or its own page and size params) answers the rows and an X-Total-Count header; paging: cursor answers X-Next-Cursor; a list cut short answers X-Truncated: true (see Query).

Statuses come from the design: 400 for a missing value or a broken rule (the body says which), 401 not signed in, 403 role too low, 404 an unknown row, 413 a body over the limit, plus each Refusal's own. A write to a versioned entity adds 412 and 428, an idempotent command 409 and 422 (and 503 in the contract), a limited operation 429. The body is always { "error": "…", "field": "…", "fields": { … } }.

Sign-in settings

Each sign-in method is an object in auth.types. Its other keys are settings.

Kind Settings (default)
session cookie (gt_session), days (14)
apikey header (X-Api-Key); for keys the service keeps itself, keys, prefix, make, scopes, expiresIn, graceFor: API keys
oidc issuer (a URL or {secret:NAME}), audience, roleClaim (roles)
jwt issuer (the service's name), audience, minutes (60)
magiclink minutes (15), link (/signin?link={token})
passkey rpId (localhost), rpName (the service's name), origin (http://localhost:3000)

A link or passkey sign-in signs in once and needs a session or jwt to keep the person signed in; lint says so. A components file can set a sign-in method's settings per environment under auth.<kind>.

Service lint

globetrotter sync --check fails on an error; lint_design and the studio's Status list them all. Many findings carry a fix, which the studio's Fix button and apply_fix apply.

Errors

Rule Says
entity-no-key An entity has no key field.
entity-two-keys An entity has more than one key field. An error on each one after the first (or after id), with the fix that takes the key off it.
sets-unknown-field A command's sets names something the entity has no field for: the command would answer 200 and change nothing. An error; when one field's name is close, the fix writes that name.
sets-key A command's sets names the entity's key. An error.
sets-value A command's sets gives a field a value its type does not take (a boolean anything but true or false, a number given words, a datetime that is not now or a written moment, a date that is not today or a written day, an enum a value it does not list), or none. An error; an enum value in the wrong case has the fix.
schedule-cron-unreadable A Schedule's cron that neither target can run: empty, not five fields, a word that is not a month or weekday name (JAN, MON are read), a value out of range (minute 0-59, hour 0-23, day 1-31, month 1-12, weekday 0-7), a range running backwards, a step of 0 or larger than the field's top value, or a form the two targets read differently: a day of the month together with a weekday, a weekday range ending in 7, @daily and the like, ?, L, #, seconds. An error.
schedule-never A cron whose day no chosen month has (31 February, 30 February, 31 in April, June, September, November). An error; 29 February alone is a warning, once every four years.
job-timeout-over-schedule A job whose timeout, when set, is longer than the gap between two runs of its schedule: a try still going when the next is due makes both targets skip that run (and say so), so the job runs less often than its schedule says. A warning; a job that sets no timeout (300 s) is not told.
schedule-no-job A Schedule that names no job. An error; with one Job in the service the Fix names it.
operation-unprotected Sign-in is on and an operation names no allow.
restore-without-soft-delete A restore command on an entity that deletes for good.
magiclink-keeps-no-one Link sign-in with no session or jwt to keep the person in.
passkey-keeps-no-one The same for passkeys.
command-spans-stores A delete cascades into an entity in another store.
audit-on-volatile-store An audited entity, or an emitting command, on redis.
relation-always-set-null An Always relation set to setNull.
file-s3-needs-bucket An error: a File kept in a bucket whose environment's components file names none (files.<name>.bucket missing in components.production.json).
file-s3-no-environment A warning: a File kept in a bucket and no environment written yet that names it.
index-unknown-field An index names a field the entity lacks.
overlap-span A no-overlap index without two fields of one date, time or number kind.
index-when-invalid An index's when that does not read (an unknown field, a comparison, today or now, an enum value it lacks) or that has no unique beside it.
where-invalid A query's where is not field=value (or a comparison) of the entity's fields, its single relations or its row times: a misspelt field, a value not of the field's type, a many relation, < or > on a link, =null on a relation that is always set or on a row time, a path through a relation that holds many or to a field it lacks, now on a date. The list is not written (it answers 501) until it reads right.
filter-invalid A param's filter is about a field the entity lacks, or is not sent in the query.
clear-invalid A param says clears on a required field, on a relation that is always set, on anything but an update, or where it fills no field and names no link. Fix: takes clears off.
list-param-keeps-nothing A list's param names no field or link of its entity, so every caller gets every row. An error when no page sends it; a warning when the design beside is not read; the fix takes the param away.
filter-type A filter that is not about the field's type (contains on a number), in without a list, isNull without a boolean.
filter-on-command A command's param says how it keeps rows.
joined-single A joined relation that is not many.
joined-across-stores A joined relation between entities of two stores.
joined-set-null A joined relation set to setNull: a join row cannot forget a link.
joined-soft-delete A join table between entities one of which deletes softly.
inverse-mismatch inverse names a relation that does not point back, is not joined, or both of a pair name each other.
through-shape A through entity without exactly one required single link to each side.
joined-ids-type A <relation>Ids param that is not a list.
joined-ids-through A <relation>Ids param on a relation that goes through an entity.
sort-invalid A sort or sortable names a field the entity lacks, or a way that is not asc or desc.
sort-sensitive A sort, a filter or a search by a sensitive field.
search-in-invalid searchIn names a field that is not text, or the entity lacks.
paging-conflict paging set on a query that also has params named page, size or cursor.
cursor-needs-list paging: cursor on a query that does not answer a list of rows.
page-size-invalid A pageSize above its maxPageSize.
client-retry-unsafe A client with retries has a POST or PATCH not marked idempotent: a retry may do it twice.
client-no-secret A client signs in (bearer, header, basic) and names no key.
client-header-name A header auth names no header, or a header (the key's, or a param's) is one the client sets itself.
client-path-param A {name} in a call's path with no path param, a path param not in the path, a path that does not start with / or has ? in it.
client-returns-shape A call returns an entity of yours.
client-returns-from A call returns a Shape that has a from: an outside answer is read from what the other side sends, not worked out from your rows.
client-body-method A GET or DELETE call with body params.
client-many-place A call's list param sent anywhere but the body.
client-duplicate-name Two clients, or two calls of one client, with the same name.
param-header-outside-call An operation's param sent in a header.
machine-state-unknown A transition goes from or to a state its field does not have, or the machine's initial or final names one; says what was meant.
machine-field-type A machine moves a field that is not an enum, or one its entity lacks.
machine-create-sets A create takes the field a machine moves: a new row starts at the initial state.
versioned-field-clash A versioned entity has a field named version: the column is the entity's own.
versioned-required-no-get An entity needs If-Match and no query gets one row of it: a caller cannot learn the ETag.
versioned-store A versioned entity kept in a store that is not postgres, sqlite or mysql: no target writes the column there.
idempotent-needs-store An idempotent command whose entity's store has no migrations, or is not postgres, sqlite or mysql: the key commits with the write, and there is no table or no transaction to keep it in.
machine-guard-invalid A guard that does not read, or reads what it may not (a path across a relation, arithmetic on a field that may be empty, a division).
transition-incomplete A transition with no from or no to.
transition-command-unset A command that does a transition names none, or none of its entity's, or no entity.
webhook-no-secret A webhook names no secret: anyone could post to it.
webhook-header An hmac webhook names no signature header, or one the web server owns.
webhook-event-id An error: an eventId or eventType that is neither a JSON pointer nor header:Name.
webhook-no-store A webhook with an event id and no SQL store with migrations to remember it in.
webhook-handler-args A handler's command has a required param its args does not read, args read one the command lacks, or args is not param=/pointer.
webhook-args-unused A warning: a handler has args and no command, so nothing reads them.
webhook-handler-tenant A tenantFrom that is neither a JSON pointer nor header:Name, or one in a design with no tenants.
webhook-tenant-missing A warning: a handler runs a command on an organisation's rows and has no tenantFrom.
tenant-needs-people Tenants with no session, jwt or oidc sign-in: nobody can belong.
tenant-claim-needs-token from: claim with no sign-in method that carries a token.
tenant-link-missing An entity whose rows belong to an organisation has no required link to it.
tenant-two-links Such an entity has two links to the organisation.
tenant-store An organisation's rows, or the membership, kept in another store than the organisation.
tenant-allow-missing An operation on an organisation's rows names no allowIn.
tenant-allow-unknown allowIn names a role tenancy.roles lacks.
tenant-allow-anyone An operation names allowIn and is allow: anyone: a stranger has no role in an organisation.
tenant-grants-misplaced grants on a command that does not create the organisation.
webhook-path-clash A webhook answers at a service's route or a path the backend answers itself.
webhook-runs-as runsAs names a role the design lacks.
webhook-runs-as-below A handler's command needs a role above the one the webhook runs as.
part-source-unknown A part reads a field (or a path) its entity lacks, or a json one; says what was meant.
part-agg-type sum or avg of text, min or max of what has no order, count with an of, an agg with nothing to work on, an of with no agg, a source beside an agg, an unknown agg, countDistinct of a calculation.
part-expr-invalid An of that does not read: a field it lacks, an operator with nothing after it, a bracket never closed.
part-type-mismatch A part's type contradicts what it reads.
part-agg-empty A part marked required that may find nothing (an average of no rows).
part-no-from A part names source, agg or of in a shape with no from.
part-nested-from A shape with a from holds a nested part: it holds only values.
part-shape-unknown A part holds a shape or entity the design lacks.
part-enum-values An enum part with no values.
shape-group-needed A column shown beside a count or a sum, and not in groupBy.
shape-group-unknown groupBy names a field the entity lacks, or has no from.
shape-sensitive A shape shows (or groups by, or takes the least of) a sensitive field.
shape-where-invalid A shape's where is not field=value of its entity, or it has none to read.
shape-store A shape reads an entity kept in a store that is not SQL.
shape-many A query answers a shape with a row for each group or row, and is not a list.
shape-command-does A command that creates, updates, deletes or restores answers a shape.
shape-cycle A shape holds itself, through its parts.
shape-no-parts A shape with a from and no parts.
target-unsupported A turned-on target cannot write a node or section, or does not write a feature the design uses (a list kept by a link through a param or in its where, a list ordered by a row time or kept by one in its where, a where across a relation or on today or now, null that empties a field or a link, an owner through a relation, a unique for some rows only: supportsFeature). The finding names each operation, which answers 501 there. Both shipped targets write all six.
limit-by-tenant-without-tenancy An operation is limited by tenant (its own limitBy, or limits.by) and the design has no tenancy.
apikey-nobody-makes Keys are managed and no sign-in method lets a person sign in to make one (session, oidc, jwt, passkey, magiclink).
apikey-needs-store Keys are managed and no SQL store with migrations is there to keep them.
scope-unknown An operation's scope is not one the managed keys list.
scope-without-keys An operation has a scope and the design's keys are not managed.

contract-drift (a page and its service disagree on a path) is raised by sync on both files; its severity follows whose move it is.

Three more come from a target's own check in sync --check, not from lint: target-check (the check could not run, or the routes and the contract disagree), target-broken (Rust: generated code that does not compile) and hand-edited (Rust: a generated file changed by hand). check_tenancy names each place your code reads across organisations as tenant-every.

Warnings

Rule Says
operation-undescribed A command has no description.
owner-param A create or update below the top role takes the entity's owner field as a param: a value sent for it beats who is signed in, so its caller can make a row for someone else or hand one over. A warning; the fix takes the param off (the row is then the asker's). Silent when only the top role may run the command.
refusal-unsaid A refusal has no message.
owner-not-applied An owner names no field, or sign-in is off; a member.email owner that reads nothing (no such relation, a list, no such field, not text, another store: this one is an error).
owner-via-beside An entity owned through a relation that has a Search, a state machine, versions or organisations.
create-lacks-field A create's params miss a field its entity needs; yours to write, 501 until then.
create-named-otherwise A create named like archive or cancel; fix makes it custom.
param-fills-nothing A create's or update's body param that fills no field of its entity (not the key, a link or a finds): a caller gets a 200 and the value is kept nowhere. An error when a field is near its name (a rename left it behind; its fix names it), a warning otherwise.
emits-without-entity A command emits an event but names no entity.
command-silent A command changes nothing and emits nothing.
route-shadowed A service's route is /docs, /redoc or /openapi.json: the API's own pages answer a GET there (the explorer in local on Python, the contract everywhere).
relation-always-many An Always relation that holds many.
index-empty An index names no fields.
overlap-unique A no-overlap index also marked unique.
overlap-on-mysql A no-overlap index on mysql, which does not keep it.
string-unbounded A short text with no longest length of its own: it takes 255, and a longer value is refused.
audit-sensitive-field A field named like a hash or token, in an audited entity, not sensitive.
read-from-where An error: a query's where or fixed sort names a readFrom field, and a role below it may run the query.
read-from-write A create or update takes a readFrom field as a param, and a role below it may run it (naming it is a 403).
read-from-required A create by a role below readFrom of a required field with no default: it cannot give it a value.
read-from-probe An info: a query filters, sorts or searches by a readFrom field a caller below it is refused.
read-from-list-row An info: a list page's row shows a readFrom field, a gap for everyone below the role.
audit-off-pii An entity with personal fields and no audit.
audit-fields-unread An entity's audited fields are not read: its audit is not fields, or they name a field it does not have, or a sensitive one.
flow-orphan A flow listens for an event no command emits.
unanswered-data A page's data that no operation answers.
list-unpaged A paged list whose page has no field named page.
through-not-unique A through entity that can hold the same pair twice; fix adds the unique index.
joined-ids-unused A <relation>Ids param on a command that neither creates nor updates.
tenant-unscoped-entity With tenants on, an entity that does not say whose rows it has; fix says scope: global.
tenant-unique-global A unique index on an organisation's rows that does not start with the organisation: the value is unique across all of them.
tenant-rls-engine tenancy.rls with a store that is not postgres: nothing is written for it.
cursor-sort-nullable A cursor over a field that may be empty: rows with none are skipped or repeated.
client-key-unused A client names a key and signs in by nothing.
client-timeout-high A client waits more than 30 seconds a try: call it from a flow step, not a request.
client-returns-unknown A call returns a name that is not a Shape of the design.
shape-at-page-route A query named list answers a shape at its service's own route, where a page reads its data: the contract keeps the page's.
cache-shape A Cache keeps a query that answers a shape: it is not kept.
shape-query-param A query that answers a generated shape takes a param, which it does not read.
client-param-ignored A call's param says how it keeps rows or finds an entity: a call's params are only sent.
machine-unreachable A state nothing moves a row to, other than the first.
machine-direct-write A generated update sets the field a machine moves, by sets or a param named for it.
versioned-no-reader A versioned entity that no query answers, one row or a list: nothing hands out the version to send back.
idempotent-anyone Sign-in is on and an idempotent command allows anyone: every caller shares one set of keys, so one who sends another's key reads that answer. (With sign-in off nothing is private, so it is not said.)
idempotent-calls-out An idempotent custom command in a design with a client call not marked idempotent: the call is outside the transaction, so a crash after it repeats it.
transition-unused A transition no command runs.
transition-emits-twice A transition and the command that runs it emit different events: the command's is written.
transition-not-run A command names a transition and does something else.
webhook-no-event-id A webhook with no event id: a retry of the same event runs it twice.
webhook-handler-shadowed A handler that never runs: an earlier one matches the same event, or every event.
webhook-keep-short keepFor shorter than tolerance: a replay in between would run again.
webhook-tolerance-unused A tolerance on a scheme that signs no time.
create-key-mixed A create takes its entity's key from the caller but may be left without it, when the store makes one: a key a caller picks can be one the store makes later (a serial's next number surely).
made-key-too-short A text key a create makes (none given) whose max is under 12: the made id is the random end of a uuid cut to the max, so two rows made close together can meet. Fix: allow 12.
param-key-type A param named for a key (id, <entity>Id, a one-link's <name>Id, or one that finds a row) that is typed something else than that key. An error; Fix types it as the key. Left as it is, both targets still read a uuid key sent as text: a valid id is accepted, anything else is a 400 naming the param ("id should be an id."), never a 500, and the contract says string, so Schemathesis's strings are the 400s it counts as rejected valid data.
param-type-differs A create's or an update's param has another type than the field it fills (an int for an email, a list for one value): a value the contract allows may be one the field cannot keep. Text, long text and a choice count as the same. A warning; Fix gives the param the field's type (and makes a list one value).
route-shared Two operations, of two services or of one, answer the same method and path: the contract has one operation there. An error on the later one, which says what to change (another route, a rename, a path param moved to the query); an info on the earlier.
route-taken An operation answers at a path a generated route already takes (a sign-in's, managed keys', organisations', a File's, a Search's, a Webhook's; a service at /session beside session sign-in). An error: the contract keeps the generated route, so no target serves the operation.
limit-per-process Limits apply and limits names no store: each process counts its own, so three processes let a caller through three times the limit.
limit-by-tenant-outside-org An operation limited by tenant runs in no organisation (it has no allowIn): it is counted by principal.
limit-sign-in-unused limits.signIn is set and no sign-in takes a password or a token (session, jwt).
apikey-never-expires Keys never expire (expiresIn: 0): a leaked key works until someone revokes it.
scope-unused A listed scope no operation needs: a key given it can call nothing with it.
scope-on-anyone An operation that allows anyone has a scope: it is only checked when a key is sent.

Notes

Rule Says
joined-unaudited A warning: a command writes a many relation kept in the implicit join table (<relation>Ids) of an audited entity; the links leave no audit row. Join it through an entity of its own.
list-unbounded A list with no paging answers its first 50 rows only; fix sets the query's paging: page. Not raised for paging: page or cursor.
key-changed-refused (not a lint finding: a refusal of the write and of sync, rule key-kind-changed) An entity's key type, or its idKind between serial, uuid and ulid, changed after a migration made its table: the save is refused naming what was asked, why (the existing ids and the foreign keys to them cannot be converted in place) and what to do (a new entity and a copy; or delete backend/migrations/<store>/ and designs/.memory/synced/<design>.<store>.*.json on a project with no data). sync writes nothing for the target and --check fails. Setting the old kind back is allowed.
required-needs-default (not a lint finding: a refusal of the write and of sync) A new field that is required with no default, or an optional one made required with none (a default counts when it parses for the type; a date, datetime, uuid or json takes none), on an entity that has a table already: its existing rows would have no value and the service would answer a plain list with an error. The save is refused and sync writes nothing, naming the two ways out: a default (false, 0, a word; old rows get it) or required: false. A new relation marked Always is refused the same way (no default can name a row; a tenant link has its own note); add it optional. A design already synced is not held to it again, only the change.
default-value (error, Fix) A field's default that does not parse for its type: a whole number for int, a number for float and decimal, a boolean word, one of an enum's values. A date, datetime, uuid or json takes no default (the migration and both targets would not write it the same way), so it counts for nothing: required: false is the way out there. The Fix gives false or 0, or takes the default off.
sort-unindexed Info: a list's first sort field, or a sortable one (a row time too), has no index starting with it, so each sort reads the whole table. Fix adds the index (by<Field>, like byUpdatedAt).
list-param-sent-unread Info: the same param, but a page sends it and nothing reads it.
update-cannot-clear-link Info: an update's optional param for an optional link, with no clears: a null is left out, so a link once set stays set. The fix sets clears.
filter-unindexed A param keeps rows by a field no index starts with; fix adds the index.
store-unused A store holds nothing.
client-no-calls A client with no calls.
client-key-honoured A call that repeats a POST or PATCH by an Idempotency-Key is only safe if the other side honours the key.
shape-no-from A shape with no from: its answer is yours to write (501 until you do).
shape-unused A shape no operation or call returns.
machine-dead-end A state nothing moves a row out of that is not listed in final.
machine-message-unused A transition says what a failed guard answers and has no guard.
transition-allow-lower A transition's own role is below every command that runs it: it adds nothing.
versioned-custom-write A custom command on a versioned entity: it takes no If-Match. Two requests changing one row at once still lose nothing: one is a 409.
versioned-no-writer A versioned entity that nothing updates, deletes or moves.
versioned-no-etag-back An update, a restore or a transition on a versioned entity that does not return the row: the caller gets no new ETag.
idempotent-natural An idempotent delete: a repeat already answers 404. The key makes it answer what the first answered instead.
transition-sets-unused A command that does a transition also has sets, which it does not read.
webhook-no-handlers A webhook with no handlers checks each delivery and does nothing with it.
webhook-handler-empty A handler that calls no command and emits no event.
webhook-preset-settings A setting a preset or an unsigned time does not read.
limit-by-principal-anyone An operation limited by principal that a stranger may call (allow: anyone, or sign-in off): a request nobody signed is counted by its address.
limit-none-on-write A command opts out of the design's default limit (limit: none).
limit-over-default An operation's own limit lets more through than the default (compared as a rate: 36001/hour is over 600/minute).
scope-missing Operations a scoped key can never call (no scope), said once per service, counted.
apikey-unaudited Keys are managed and nothing is audited: making, rotating and revoking a key, and what a key changes, leave no audit row.
apikey-org-unscoped Keys are managed in organisations whose roles share no name with the sign-in roles, and no scope is listed: a key acts with everything its maker may do in the organisation.

Environment variables

What a generated Python backend reads where it runs.

Variable Read by What it does
GLOBETROTTER_ENV Everything The environment; settings come from designs/components.<env>.json. Unset is production, and the server and migrate refuse to start: only the exact word local is a laptop.
GLOBETROTTER_<STORE>_URL Settings, migrate A store's address, over the components file's. GLOBETROTTER_DB_URL for a store named db.
a secret's name Settings The value of a {secret:NAME}, set where the backend runs.
HOST, PORT python -m <app>_fastapi Where it listens. Default 127.0.0.1 and the config's port, else 8000.
WORKERS python -m <app>_fastapi Processes outside local. Default 1; local runs one, reloading.
LOG_LEVEL The app, the relay Log level on stderr. Default INFO.
GLOBETROTTER_BROKER_URL Relay, worker, scheduler The Redis a worker flow's events go through. The Python scheduler reads it too: with it, every job is sent to the worker (run the worker); it is also the first place a due minute is claimed.
GLOBETROTTER_SCHEDULER_GRACE Python scheduler, Rust worker Seconds (default 30) a job in flight may finish after SIGTERM or Ctrl-C. Past it the run is cancelled and marked abandoned. A second signal stops at once.
GLOBETROTTER_MAX_BODY The app The largest request body, in bytes. Default 2 MB; larger is a 413.
GLOBETROTTER_CORS_ORIGINS The app Origins of pages on another site that may call with credentials, comma-separated. None by default; * is refused.
GLOBETROTTER_LIST_DEFAULT, GLOBETROTTER_LIST_MAX Generated services (a SQL store) The rows a list returns when no size is asked (50), and the most one read returns (200).
GLOBETROTTER_DB_POOL_SIZE, GLOBETROTTER_DB_MAX_OVERFLOW, GLOBETROTTER_DB_POOL_TIMEOUT, GLOBETROTTER_DB_POOL_RECYCLE db.py, postgres and mysql Connections kept per process (10), more while busy (10), seconds to wait for one (30), seconds before one is renewed (1800). GLOBETROTTER_<STORE>_POOL_SIZE and so on set one store.
GLOBETROTTER_DB_STATEMENT_TIMEOUT_MS db.py, postgres and mysql The longest one statement may run, in ms (30000; 0 for none). Per store: GLOBETROTTER_<STORE>_STATEMENT_TIMEOUT_MS.
GLOBETROTTER_SIGNIN_MAX_FAILURES, GLOBETROTTER_SIGNIN_WINDOW_SECONDS Password and session sign-in Failed sign-ins one client may make (5) in the window (60 s) before a 429; they win over the design's limits.signIn. Counted per process, or in the limits store when the design names one.
GLOBETROTTER_LIMITS A design with rate limits off turns every operation's limit check off, not the sign-in's. The generated contract tests set it.
GLOBETROTTER_SESSION_SECRET Session sign-in Signs session cookies. Required outside local.
GLOBETROTTER_JWT_SECRET jwt sign-in Signs the service's tokens. Required outside local.
GLOBETROTTER_MAGICLINK_SECRET magiclink sign-in Signs sign-in links. Required outside local.
GLOBETROTTER_PASSKEY_SECRET passkey sign-in Signs passkey ceremonies. Required outside local.
GLOBETROTTER_PASSKEY_RP_ID, GLOBETROTTER_PASSKEY_ORIGIN passkey sign-in Override the design's rpId and origin.
GLOBETROTTER_API_KEYS apikey sign-in id:role:key, comma-separated. In local without it, dev-<role>-key per role.
GLOBETROTTER_<CLIENT>_URL A design's clients Where a client is (GLOBETROTTER_PAYMENTS_URL for Payments), over the components file's clients.<name>.baseUrl. Outside local, one of the two is required.
a client's key ({secret:PAYMENTS_KEY}) A design's clients The key a client signs in with. Required outside local; the backend refuses to start without it, saying which.
a webhook's secret ({secret:STRIPE_WEBHOOK_SECRET}) A design's webhooks The secret a delivery is checked against. Required outside local (every missing one is named in one line and the backend exits 1); in local the development secret whsec_local_development stands in, with a warning.
GLOBETROTTER_PEOPLE Password sign-in email:role:password, comma-separated. In local without it, one per role.
GLOBETROTTER_FILE_SECRET Files Signs file links. Required outside local.
GLOBETROTTER_<STORE>_DIR Files A folder for a store's files, such as a mounted volume.
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION Files in a bucket The bucket's key, secret and region when the components file's block names none (accessKey and secretKey as {secret:NAME} name others). Outside local a key and secret from one place or the other are required.
GLOBETROTTER_SMTP_URL Notify smtp://user:password@host:587 or smtps://; an email goes by SMTP.
GLOBETROTTER_WEBHOOK_URL Notify A webhook notice is POSTed here as JSON.
GLOBETROTTER_TRACES_KEEP Traces How many spans the local trace file keeps. Default 5,000.
GLOBETROTTER_METRICS Metrics 1 serves GET /metrics (Prometheus text, per process, with each store's pool gauges).
GLOBETROTTER_METRICS_TOKEN Metrics When set, /metrics answers only to Authorization: Bearer <token>.
GLOBETROTTER_OBSERVE Traces off turns traces, metrics and logs off, for a quiet test run.
OTEL_EXPORTER_OTLP_ENDPOINT Traces Where the otlp exporter sends. OpenTelemetry's own variable.
GLOBETROTTER_BACKEND_URL The pages' src/proxy.ts Where /api/* goes, at each request.
GLOBETROTTER_TEST_BASE_URL backend/tests Press a backend already running (another target's) instead of the app in process.
GLOBETROTTER_TEST_API_KEY, GLOBETROTTER_TEST_TARGET backend/tests The key the tests sign in with, and the target a served run is of.
GLOBETROTTER_<STORE>_TEST_URL backend/tests (Python), the generated Rust tests The database a test run empties for a store on postgres or mysql (GLOBETROTTER_DB_TEST_URL for db); its name must say test. Python's suite refuses without it. Rust's database tests, without it, return with one sentence on stderr each (cargo test -- --nocapture shows it) and cargo test exits 0; with GLOBETROTTER_REQUIRE_DB=1 or CI set, each fails naming the variable.
GLOBETROTTER_REQUIRE_DB, CI The generated Rust tests Either set turns the skip above into a failure.

GET /health answers while the process is up. GET /ready answers once every store is reached and migrated, and says what is behind with a 503 until then. They are not in the contract. globetrotter status lists each environment's secrets.

Next: Generated code, Auth and security, Deploy and operate.