{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://nerdout.com/workshop/sdk/draft-schema.json","title":"Nerd Out app draft submission","type":"object","additionalProperties":false,"required":["summary","verification"],"oneOf":[{"required":["package"],"not":{"required":["fromPreview"]}},{"required":["fromPreview"],"properties":{"fromPreview":{"const":true}},"not":{"anyOf":[{"required":["package"]},{"required":["sampleData"]}]}}],"properties":{"package":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://nerdout.com/workshop/sdk/schema.json","title":"Nerd Out app package","type":"object","additionalProperties":false,"required":["manifest","files"],"properties":{"manifest":{"type":"object","additionalProperties":false,"required":["format","sdk","name","summary","icon","data","permissions"],"properties":{"format":{"type":"integer","const":2},"sdk":{"type":"string","const":"2.0"},"name":{"type":"string","minLength":1,"maxLength":80,"description":"Shown as the app's title."},"summary":{"type":"string","minLength":1,"maxLength":200,"description":"One sentence under the title: what the app does."},"icon":{"anyOf":[{"type":"string","pattern":"^(Lia|Tfi|Lu|Pi|Tb|Hi|Md|Ri|Bs|Fi|Io|Bi|Ai|Go|Rx|Gr|Cg|Sl|Fc|Di)[A-Z0-9][A-Za-z0-9]{0,80}$"},{"type":"string","enum":["sparkles","check-square","calendar","list","notebook","chart","timer","map","heart","star","tag","wallet","book","leaf","camera","music"]},{"type":"string","pattern":"^custom:[0-9a-f]{32}$"}],"description":"The app icon: an icon library name such as \"LuNotebook\" (search /api/apps/v1/icons?q=...), the \"custom:...\" name returned by an icon upload (POST /api/apps/v1/apps/{appId}/icon), or one of the built-in glyphs."},"groupInviteMessage":{"type":"string","minLength":1,"maxLength":240,"description":"One plain-text line for group invitation emails. Requires groupLabel."},"groupLabel":{"enum":["Group","Household","Team"]},"shareImage":{"type":"string","pattern":"^custom:[0-9a-f]{32}$","description":"Optional picture for link previews: the \"custom:...\" name returned by POST /api/apps/v1/apps/{appId}/share-image. Leave it out and a card is drawn from the name, summary, icon and theme."},"icons":{"type":"array","maxItems":400,"uniqueItems":true,"items":{"type":"string","pattern":"^(Lia|Tfi|Lu|Pi|Tb|Hi|Md|Ri|Bs|Fi|Io|Bi|Ai|Go|Rx|Gr|Cg|Sl|Fc|Di)[A-Z0-9][A-Za-z0-9]{0,80}$"},"description":"Icon names the app chooses at run time. Names written literally as data-icon=\"X\" or icon(\"X\") are found without this."},"theme":{"type":"string","enum":["harbor","paper","midnight","terminal","garden","sunset","slate","candy","lagoon"],"description":"The palette: the app's colors, with light and dark variants behind the same --nerd-* variables. Each palette brings its own style (see style). Default \"harbor\" (Nerd Out's own palette). See /workshop/sdk/themes.json for each palette's mood and style."},"style":{"type":"object","additionalProperties":false,"description":"Optional overrides of the palette's own style, so any palette works with any shape.","properties":{"corners":{"type":"string","enum":["square","slight","rounded","pill"]},"shadow":{"type":"string","enum":["none","soft","hard"]},"font":{"type":"string","enum":["sans","serif","mono","rounded"]},"borders":{"type":"string","enum":["hairline","bold"]},"density":{"type":"string","enum":["compact","comfortable","roomy"]}}},"accent":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","description":"Optional custom accent color; adjusted per scheme so fills and text keep their contrast."},"data":{"type":"object","additionalProperties":false,"required":["scope","collections"],"properties":{"scope":{"type":"string","enum":["device","account","app"],"description":"device: records stay in the viewer's browser. account: each signed-in person has their own records, live on all their devices (browser copy when signed out). app: one set of records shared live by every member. The owner picked it when creating the app; read it from the context. Cannot change after the first publish."},"documents":{"type":"boolean","description":"true: the app may open shared text documents with nerd.docs (Yjs, merged character by character, live). Scoped like records: per person for account scope, shared for app scope. Leave out when unused."},"files":{"type":"boolean","description":"true: the app may store photos and files with nerd.files (images are resized in the frame; up to 10 MB each). Scoped like documents."},"comments":{"type":"boolean","description":"true: people may comment on records and mention each other with nerd.comments. Not for device scope."},"collections":{"type":"object","description":"Kinds of records the app saves. Use {} when it saves nothing.","propertyNames":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{0,63}$"},"maxProperties":16,"additionalProperties":{"type":"object","additionalProperties":false,"required":["fields"],"properties":{"fields":{"type":"object","propertyNames":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{0,63}$"},"minProperties":1,"maxProperties":64,"additionalProperties":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["string","number","boolean","date","datetime","select","ref","file","list","url","member","members"],"description":"string, number, boolean; date (\"2026-11-07\"); datetime (ISO 8601 with Z or an offset); select (one of options); ref (a record id in collection); file (an id from nerd.files); list (an array of strings); url (an http(s) web address; the form adds https:// and validates); member (one member id; the form shows a people picker); members (a list of member ids, up to max)."},"optional":{"type":"boolean","description":"True when a record may omit the field. New fields added after the first publish must be optional."},"maxLength":{"type":"integer","minimum":1,"maximum":20000,"description":"string: default 2000. list: each item, default 200."},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":80},"minItems":1,"maxItems":50,"uniqueItems":true,"description":"select: the choices. list: makes it a multiple choice (every item is one of these; the form draws toggle chips) instead of free text tags. Later versions may add options, never remove them."},"collection":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_]{0,63}$","description":"ref only: the collection the id points into."},"max":{"type":"number","description":"list and members: most items (a whole number from 1 to 100, default 20). number: the largest value allowed; for a rating, the number of stars (2 to 10, default 5)."},"min":{"type":"number","description":"number only: the smallest value allowed."},"step":{"type":"number","exclusiveMinimum":0,"description":"number only: the control's increment (1 for whole numbers, 0.01 for cents). The form gives a number with a step and a min minus and plus buttons."},"format":{"type":"string","enum":["plain","money","percent","rating"],"description":"number only: how it reads. \"money\" (with currency), \"percent\" (0.25 shows as 25%), \"rating\" (whole numbers from 1 to max, drawn as stars). Forms, recordFacts and nerd.ui.formatField follow it."},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"With \"format\": \"money\": the currency code, default \"USD\"."}}}},"fieldOrder":{"type":"array","items":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_]{0,63}$"},"maxItems":64,"description":"The order nerd.ui.form, editSheet and recordFacts take the fields in. Leave it out: it defaults to the order the fields are written in, and the server fills it in. Set it only to ask for the fields in another order."},"scope":{"type":"string","enum":["account","app","space","link"],"description":"Overrides data.scope for this collection: a shared board can keep each person's settings private (account), a personal app can share one collection (app), space keeps one set per space that only its members can read (nerd.spaces; create records with { space }), and link is a collection whose records live in another app the owner links this one to (empty until they do; no ref fields; see links.md). Not for device scope; fixed after the first publish."},"contribute":{"type":"boolean","description":"true: Participants (people the owner invites to add their own entries) may add records to this collection, and change or remove only the ones they added (a sign-up line, a log entry). Everyone else is unchanged: Managers change anything, Viewers nothing. Only for a shared (app-scope) collection. ctx.data.ownOnly lists these collections for such a person, and nerd.data.canChange(collection, record) says whether a record is theirs to change."}}}}}},"permissions":{"type":"object","additionalProperties":false,"properties":{"openUrl":{"type":"boolean","description":"True when the app offers links to websites. The host asks the viewer before opening one in a new tab."},"notify":{"type":"boolean","description":"True when the app sends reminder or digest emails with nerd.notify. Not for device scope."},"location":{"type":"boolean","description":"True when the app asks where the viewer is with nerd.locate (nearby places, logging where something was seen). The host asks the viewer each time; the app gets a position only on their yes."},"voice":{"type":"boolean","description":"Open the Workshop recorder from a tap. Requires data.files."},"transcription":{"type":"boolean","description":"With consent, transcribe a saved English recording on this device. Requires data.files. The optional language download is shared across Workshop apps in this browser."},"pointerLock":{"type":"boolean","description":"Lets the app request mouse capture after a player clicks. Escape releases the pointer."},"wasm":{"type":"boolean","description":"Lets the app compile and run WebAssembly (WebAssembly.instantiate with bytes from nerd.assets). Nothing else is evaluated, and the frame still has no network."},"workers":{"type":"boolean","description":"Lets the app start worker threads from blob: addresses it makes in the frame (new Worker(URL.createObjectURL(blob))). A worker has no network and cannot import scripts: post it the code and bytes it needs."},"paste":{"type":"boolean","description":"True when the app asks for the text the viewer last copied with nerd.paste (a Paste button). The host asks the viewer each time."},"share":{"type":"boolean","description":"True when the app offers to copy text (nerd.copy), share a link (nerd.share) or save a file such as a CSV or a calendar entry (nerd.download). The host asks the viewer each time."}}},"integrations":{"type":"object","description":"Third-party APIs the app may call with nerd.integrations.call(name, operation, inputs), through Nerd Out's server, with a credential each person connects and the app never holds. Not for device scope. Read /workshop/sdk/integrations.md before declaring one: an app calls declared operations with typed inputs, never free paths, and the validator's errors say exactly what an operation may hold.","propertyNames":{"pattern":"^[a-z][a-z0-9-]{0,31}$"},"maxProperties":8,"additionalProperties":{"type":"object","additionalProperties":false,"required":["label","origin","auth","operations"],"properties":{"label":{"type":"string","maxLength":40,"description":"The service's name as people know it: \"GitHub\"."},"origin":{"type":"string","pattern":"^https://","description":"One exact https origin (no path). Every operation goes there and nowhere else."},"auth":{"type":"object","required":["kind"],"description":"How the credential is sent: { \"kind\": \"bearer\" }, { \"kind\": \"header\", \"header\": \"X-Api-Key\", \"prefix\"? }, { \"kind\": \"basic\" }, { \"kind\": \"query\", \"param\": \"apikey\" }, or { \"kind\": \"oauth2\", \"authorizeUrl\", \"tokenUrl\", \"scopes\", \"revokeUrl\"?, \"pkce\"?, \"tokenAuth\"?: \"body\" | \"basic\", \"authorizeParams\"?, \"identity\"?: { \"path\", \"field\" } }."},"headers":{"type":"object","maxProperties":8,"additionalProperties":{"type":"string","maxLength":256},"description":"Fixed headers sent with every call (Accept, an API version). Never the credential."},"operations":{"type":"object","minProperties":1,"maxProperties":32,"propertyNames":{"pattern":"^[a-z][A-Za-z0-9]{0,47}$"},"additionalProperties":{"type":"object","additionalProperties":false,"required":["summary","method","path","effect"],"properties":{"summary":{"type":"string","maxLength":80,"description":"What it does, in the words a person reads before connecting: \"Read your repositories\"."},"method":{"type":"string","enum":["GET","HEAD","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","maxLength":1024,"description":"Starts with /, fixed segments and whole-segment {placeholders}: \"/repos/{owner}/{repo}/issues\"."},"params":{"type":"object","description":"One entry per {placeholder}: an integer, an enum, a const, or a string with format segment, slug or uuid."},"query":{"type":"object","description":"Declared query values. A const is always sent and never supplied by the app."},"body":{"type":"object","description":"Declared body fields (write operations): scalars, an array of scalars, or one level of object."},"bodyEncoding":{"type":"string","enum":["json","form"]},"effect":{"type":"string","enum":["read","write"],"description":"GET and HEAD are \"read\"; every other method is \"write\"."},"confirm":{"type":"boolean","description":"Writes only: Nerd Out shows the service, the summary and every input and asks before sending."},"result":{"type":"object","additionalProperties":false,"properties":{"arrayAt":{"type":"string"},"fields":{"type":"array","items":{"type":"string"}},"maxItems":{"type":"integer"}},"description":"What of a 2xx JSON answer reaches the app: the list at arrayAt, each item cut to fields, at most maxItems. Recommended; required when the key travels in the address."}}}},"setupUrl":{"type":"string","pattern":"^https://","description":"Where a person creates their key or the owner registers an OAuth client."},"setupHint":{"type":"string","maxLength":200,"description":"What kind of key to create and which permissions these operations need."}}}},"sources":{"type":"object","description":"Outside data the server fetches on a schedule (nerd.sources): https JSON, public or behind an API key the owner adds on their app page (see key). The owner approves each host when publishing.","propertyNames":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{0,63}$"},"maxProperties":5,"additionalProperties":{"type":"object","additionalProperties":false,"required":["url","every"],"properties":{"url":{"type":"string","maxLength":2048,"pattern":"^https://","description":"GET, no credentials, no redirects, JSON only, at most 256 KiB."},"every":{"type":"string","enum":["15m","1h","6h","1d"]},"pick":{"type":"string","pattern":"^[A-Za-z0-9_$]+(\\.[A-Za-z0-9_$]+)*$","description":"A dotted path to keep only part of the response."},"key":{"type":"object","additionalProperties":false,"required":["in","name"],"description":"For an API that needs a key: where the key goes. The value never goes in the manifest; the owner adds it on their app page and the server sends it only to this source's host. { \"in\": \"header\", \"name\": \"Authorization\", \"prefix\": \"Bearer \" } or { \"in\": \"query\", \"name\": \"apikey\" }.","properties":{"in":{"type":"string","enum":["header","query"]},"name":{"type":"string","maxLength":63},"prefix":{"type":"string","maxLength":20,"description":"Headers only: a word and a space before the key, such as \"Bearer \"."}}}}}}}},"files":{"type":"object","additionalProperties":false,"required":["index.html","app.js","style.css"],"properties":{"index.html":{"type":"string","description":"A body fragment: no <!doctype>, <html>, <head>, <body>, <script>, <link>, <meta> or on*= attributes."},"app.js":{"type":"string","description":"A classic script (no import/export). Bundle your own code and any library into this one file. window.nerd is available before it runs."},"style.css":{"type":"string","description":"Styles. Use the --nerd-* theme variables; no @import or remote url()."}}},"assets":{"type":"object","description":"The app's own binary files (nerd.assets), by the name the app loads each one by. Upload each file first with PUT /api/apps/v1/apps/{appId}/assets/{sha256} (the raw bytes as the body); a package naming a file not uploaded for this app is refused. At most 1000 files, 4194304 bytes each and 134217728 bytes together; they do not count toward the package's own size. Leave it out when the app has none.","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9._/-]{0,119}$","not":{"anyOf":[{"pattern":"\\.\\."},{"pattern":"/$"}]}},"maxProperties":1000,"additionalProperties":{"type":"object","additionalProperties":false,"required":["sha256","bytes"],"properties":{"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"The file's SHA-256, 64 lowercase hex digits: the address it was uploaded to."},"bytes":{"type":"integer","minimum":1,"maximum":4194304,"description":"The file's size in bytes, as the upload answered."}}}}}},"fromPreview":{"type":"boolean","const":true,"description":"Submit the live preview exactly as last pushed (its package and sample data) instead of sending a package."},"summary":{"type":"string","minLength":1,"maxLength":2000,"description":"For the owner, in plain words: what they will see and what changed."},"verification":{"type":"string","minLength":1,"maxLength":8000,"description":"For the owner: which checks you ran (widths, empty state, saving, both themes) and anything you could not check."},"sampleData":{"type":"object","description":"Optional. Realistic disposable records per collection so the preview is not empty: { \"tasks\": [ { \"title\": \"...\" } ] }, plus the reserved keys $docs, $comments, $sources and $files (see the guide)."},"requestId":{"type":"string","description":"Optional UUID you make up for this submission (not the owner's request). Resending the same requestId returns the same draft instead of creating another."},"asked":{"type":"string","maxLength":500,"description":"Optional. What the person asked for that this change answers, in a few of their own words (\"make the buttons bigger\"). Leave it out when they did not ask for it. Nerd Out reads it to learn what the kit should do by itself."},"kind":{"type":"string","enum":["look","layout","wording","feature","behavior","data","sharing","bug","own","other"],"description":"Optional. What sort of change this is: look (colors, type, spacing, icons), layout (where things are, screens, navigation), wording (labels and text), feature (something new the app does), behavior (how something it already does works), data (what is saved, or the sample data), sharing (who sees or changes what, invitations, reminders), bug (something was broken), own (nobody asked: your own fix or follow-up), other."},"trouble":{"type":"string","maxLength":1000,"description":"Optional. What gave you trouble on this change, for Nerd Out to fix: a part of the guide that was unclear or wrong, something the kit lacked, a finding you could not make sense of, a workaround you had to write. One or two plain sentences. Leave it out when nothing did. It is for Nerd Out: the owner's page never shows it."}}}