Mote: the docs
Start
index.md

Mote: the docs

Mote is a language for apps that run in a browser: one file is the whole app, its pages, back end, data and sign-in, and one Rust binary with no dependencies compiles it. This page is the map of its docs. Start with card.md (the language in brief: most programs can be written from it), then come here to find the page with the whole story. Every component and battery is live, with its source beside it, in the playground at https://playground.motelang.com.

Getting started#

sh
rustup target add wasm32-unknown-unknown # once
cargo install --path compiler # in a checkout of the repository
mote editor vscode # or cursor, neovim, helix, …
mote dev app.mote # serve it, reload on save

The compiler is Rust; it builds its batteries to wasm, hence the target. Bun runs the back end of a program that has one (server fn, model); mote dev starts it for you. Nothing else is installed: there is no package to fetch. cli.md has every command, editor-plugin.md what the editor then does.

What Mote is#

Mote is a language for writing apps that run in a browser, and the tools that go with it. One .mote file is an app: declarations (state, actions, functions) and markup, in one indented syntax. The compiler turns it into one static HTML page, and, when the program has functions that must run on a server, one JavaScript module for Bun.

Examplea whole program
state n = 0
button `Pressed ${n} times` press={n += 1}
text
mote build app.mote --single writes dist/index.html
mote dev app.mote serves it and reloads on save

How the pieces fit#

text
app.mote (+ files it uses, assets/, public/, agents.mote)
│
▼
the compiler (compiler/, Rust, one binary: `mote`)
│ lex → parse → check types → emit JavaScript and HTML
│ picks the runtime parts, kit components, batteries and icons the program uses
▼
dist/index.html one page: HTML, CSS, one script. Static: any host serves it.
dist/server/main.js only if the program has `server fn`s or `model`s: run with Bun
dist/… manifest, service worker, icons, assets (an installable, offline app)
  • The compiler (compiler/src/*.rs) checks the whole program before it writes anything, and its messages say what to write instead.
  • The runtime (runtime/) is what a page runs on: a small reactive core (signals and effects), the DOM helpers, events, storage, widgets. It is written in Mote's own runtime dialect and compiled by the compiler. It is divided into parts; a page carries only the parts its program needs.
  • Batteries (batteries/) are the heavy pieces of the standard library, written in Rust and compiled to wasm: picture codecs, zip, workbooks, argon2, MP4, code scanning, full-text search, syntax trees, fonts. They run in workers, never on the page's own thread. A build writes each one a program can use as a file beside the page (assets/zip.<hash>.wasm), which the page fetches when it is first called and the browser keeps; a page built --single carries them inside.
  • The kit (kit/) is about 770 components written in Mote (buttons, dialogs, tables, chat, code blocks). A capitalised tag the page does not declare is looked for there; a page carries only those it uses.
  • The back end (runtime/server/) is what server/main.js is made of: it serves the page, answers the page's calls, keeps accounts, pushes live values and notifications. It runs on Bun.

There is no framework to install, no bundler, no node_modules. What ships is what the program uses.

How to use these docs#

To write or change a Mote program (the usual case):

  1. Read card.md. It is short and stands alone for the common cases.
  2. Read language.md and markup.md once. They are the two halves of every program.
  3. Look up the rest when you need it, through the how do I… table or the namespaces.
  4. Run mote check file.mote after every change. The compiler's messages name the fix. Trust it over memory: it knows exactly what exists.
  5. Do not guess a name. If a call is not in these pages, it does not exist; mote check will say so, with what the namespace does have.

Three rules explain most first mistakes:

  • Only an action (or a {…} handler) writes state. A fn is pure.
  • A call that can fail must meet else or ? where it is made.
  • In markup a space ends a value: anything with an operator goes in parentheses.

To work on Mote itself (the compiler, the runtime, a battery, the kit): read internals.md, then ../runtime/README.md for the runtime dialect, then testing.md. Every page ends with In the source, which names the files and functions behind what it describes.

Each topic page is complete for its subject and can be read alone. Each starts with a whole program, then a Mental model (how it works underneath), then every form, what is refused, and the pitfalls.

The pages#

Grouped as the site's side list groups them; the site reads them in this order.

Start#

The language in brief, before anything else.

PageWhat it answers
card.mdThe language in brief: what to read first. mote card prints it.

Language#

What every program is made of.

PageWhat it answers
language.mdDeclarations, types, none and T?, wasm fn (experimental), logic, built-in calls, a call that can fail, bytes, files and use, packages.
js.mdJavaScript of the program's own, a last resort (what comes first, and what it is for): extern js (the typed fns a file exports, on the page, in a worker, on the back end; an element handed to a widget; what ships), extern script (another site's script in the head, integrity=), and the edge of what the compiler checks.
reactivity.mdWhen things run and re-run: state, derive, resources, tasks, timers, watch; newest (a later run calls an earlier off); what is tracked; workers, and what is moved to them; fns main / fns off said once for a file or a package.

The page#

What is on the screen, and what it hears.

PageWhat it answers
markup.mdTags, text, values, styles, colour roles, conditional styles and group, binding, if/for/match, try / else err / again (a part of the page that fails shows a fallback), routes, components and slots, named slots, popovers, icons, assets.
events.mdEvery event and what it hands a handler, it in a block, dragging (drag=, dropped=), every drag ending once (pointercancel), swiping (swipe=), paste, keys and chords, shortcut for the whole page, ref= and el.….
kit.mdHow the kit works, the everyday components, the index into kit/.
kit/*.mdEvery kit component, by family: base, more, chat, ai, code, markdown, flow, editor, richtext, terminal.
widgets.mdeditor, richtext, terminal, flow; where every built-in element is documented.
agents.mdPages agents can use: data-mote, the mote-agent block, agents.mote, llms.txt.

Data#

What is kept, in the browser and on the back end.

PageWhat it answers
data.mdpersist and store, net, db, sql, fs, clipboard, crypto, zip, notifications without a back end.
tables.mdcsv and xlsx: CSV and Excel workbooks read (typed into a shape, or a large CSV a piece at a time) and written, on a page and on the back end.
models.mdmodel and local model: a schema that is also typed reads and writes; filters, with, atomic; put and inc; counting and summing by fields; rules (and a rule that reads a setting), hidden fields, hooks, live finds and what a write sends them; a write that shows at once (pending(row), confirmed); models chosen at run time; schema.lock, migrate and changing a schema.

Back end#

The server a program brings with it.

PageWhat it answers
back-end.mdserver fn, signing in, live values, events, notifications, proc, fs.folder; who may do what (rule, requires, limit, --access), secret(), acting as someone; job fn, server at, server every; logs, failure kinds, on failure, stacks by .mote lines, health and stopping; a call answered once; calls to another Mote back end, api.json; snapshots, one database for several apps; running it.
delivery.mdHow a build reaches a browser: the same source and compiler give the same bytes (mote build --check), build.txt and the build's hash (app.build()), policy=strict (a Content-Security-Policy made from the build, with HSTS, Referrer-Policy, COOP and Permissions-Policy; connect=), update=ask (on app.update, app.check(), app.update()), and what none of it protects from.
calls.mdCalls between browsers: rtc.join, a call's peers, mute, camera, screen sharing, messages, video of=; server call (who may be in a room); STUN and TURN.

Media and drawing#

Pictures, sound, video, canvases, text.

PageWhat it answers
media.mdimg (formats, deep pictures, colour), paint (brushes, layers) and canvas layers=, scan, camera, vid/aud/reel (a film's tracks, keys and grades), speech.
charts.mdCharts: a component for each kind (line, area, bar, scatter, box plot, heat map, pie, candlestick, Sankey, treemap, sparkline …), Chart with marks as children, a million points, zoom and brush, the keyboard, theming.
drawing.mdsurface (draw.…: gradients, layers, a drawing as a picture, typing), surface gl (gl.…, a picture through a shader), the 3D canvas (canvas boxes=, canvas scene=).
scene.mdcanvas scene= in full: three.* records, materials, pictures on them (map, mapSize, grain, sides), lights, the camera.
words.mdLanguages and formats: the app's own strings (words "de", t("key", {name}) checked against the keys, counts), the language shown (words.lang, words.choose, <html lang>), fmt.number/currency/percent/list/plural, screen.lang.
text.mdre and raw strings, search, syntax (code and Markdown), font (font files: layout, outlines), Highlight, CodeBlock, Markdown.
pdf.mdpdf: PDF files made from parts (text in standard and embedded fonts, tables, pictures, drawing, headers and footers, links, an outline), read (text with places, pictures, metadata, form fields), changed (forms filled and flattened, merged, pages picked, turned, stamped); showing one.

Extensions#

Packages of ordinary Mote shipped beside the compiler, taken with one use line.

PageWhat it answers
../extensions/README.mdWhat an extension is, taking one ([packages] in mote.toml, use "pkg:…"), writing one (wants fn, a rule, a route, a named slot, settings, tests); each extension's own README: usage, usage-forward, google, oauth, jwt, totp, passkey, magic, admin, stripe, paypal, paddle, polar, mail, replicate, s3, aws, gcloud, azure, ai, twilio, slack, discord, notion, airtable, linear, github, graphql, telegram, mcp, alert, sentry, captcha, postgres, redis.
analytics.mdEvery event kept and asked: log (an append-only durable log, consumers, replay, the capture door, PostHog's shapes), fact (an analytics table on SQLite or ClickHouse, rollups), the questions (trends, funnels, retention, paths, stickiness, lifecycle, frequency, people), and the usage extension's product analytics: people, cohorts, flags, experiments, dashboards, the panel.
usage.mdWhat people do in a program, in its own admin page: usage=on, what is collected and what never is, cookies and consent, the web's numbers (visitors, visits, bounces, sources, countries, devices, goals, speed), track, the usage extension's panel and questions, several apps in one panel, server on usage.
google.mdContinue with Google, an extension: the console's steps, the settings, GoogleButton, what is kept, whose account someone from Google is and why, a Workspace domain, googleMay (who may come in), shared accounts, running behind a proxy.
oauth.mdSigning in with GitHub, Microsoft (tenants, work addresses), Apple, Discord, GitLab, LinkedIn, Slack, any OpenID provider by its issuer, and a connection for each customer (B2B single sign-on); a provider's tokens sealed and refreshed for its API (oauthToken); client credentials and the device code; how to check each against the real provider.
second-factor.mdSecond factors in auth (auth.owed, auth.secondPassed, requires secondFactor(10)); codes from an app (TOTP, recovery codes, a QR code writer); passkeys checked on the back end (how many an account, AAGUIDs, attestation asked for and not checked), and passkey.create / passkey.get in a page, with or without a back end; a key from a passkey (the PRF extension, passkey.prfSupported).
jwt.mdA public API's door: API keys (shown once, kept as a hash, scopes, last used, taken back), tokens the back end signs, /.well-known/jwks.json and rotation, requires scope("…") and apiCall.
magic.mdSigning in by a link or a code in a mail, over the mail extension.
saml.mdSAML and SCIM: not built, why, what a B2B product loses, what OIDC by issuer covers, and the design they would have.
services.mdAnother service without a package: what you would npm install and what to use in Mote, and an extension for a service that is not here, in forty lines.
stripe.mdPayments, billing and marketplaces with Stripe, an extension: Checkout in every mode, the portal, the plans kept at Stripe from the code (stripeSync), subscriptions (trials, proration previewed, seats, pause, a downgrade at the period's end), usage on meters, invoices, credit notes, tax, saved cards and charges off-session, payment links, disputes, payouts, Connect; the kinds of failure; idempotency; every event (Stripe-Signature, each once, read fresh, caught up after downtime), StripePlan, stripeStanding and stripeCan with a grace; testing a program's hooks; a restricted key's rights; the API version; checking it in test mode in ten minutes.
paypal.mdPayments and subscriptions with PayPal, an extension: orders (approve, capture once, authorize, refund), subscriptions, payouts; the kinds of failure; events checked by PayPal's verify call, each once; checking it against PayPal's sandbox; why there is no one billing facade.
paddle.mdPaddle Billing, a merchant of record, an extension: transactions and checkout links, customers, subscriptions (proration, pause, resume, cancel), refunds as adjustments, the portal; Paddle-Signature events, each once; checking it in Paddle's sandbox.
polar.mdPolar, a merchant of record for software, an extension: checkouts and checkout links, customers by external_id, subscriptions, benefits (polarCan), orders, refunds, the portal; Standard Webhooks (webhook.check), each once; checking it in Polar's sandbox.
mail-library.mdThe mail extension's library: a message parsed (RFC 5322, MIME, encoded words, RFC 2231, nested parts, legacy character sets) from a reader with each body a piece at a time, in a page, a worker or the back end alike; mbox files a message at a time; addresses, Punycode, the Public Suffix List.
mail.mdMail through Resend or Cloudflare Email Service, an extension: mailSend and its fields, batches, a message for later, the suppression list, Resend's events (Svix signatures), bodies from Markdown, checking it against the services.
replicate.mdRunning models on Replicate, an extension: a prediction by its version, waited for or streamed; a run kept as a row and followed by a job and the webhook until it ends; files in and out; the kinds of failure.
postgres.mdPostgres, an extension: its wire protocol written out on tcp.open, TLS and SCRAM-SHA-256, parameters never in the text, values by type, a pool, transactions and savepoints, LISTEN/NOTIFY, COPY, a cancel; Supabase, Neon, RDS and poolers; checking it against a real server.
redis.mdRedis, an extension: RESP2 and RESP3 on tcp.open, or Upstash's REST API behind the same calls; strings, hashes, lists, sets, sorted sets, streams, pipelines, MULTI/EXEC, pub/sub; a rate limiter, a lock with a fencing token, cache-aside.
s3.mdFiles in an S3-compatible bucket (AWS, R2, B2, MinIO), an extension: SigV4 written out and checked against AWS's examples, put, get, head, delete, list, uploads in parts, presigned addresses for a browser; what a model's file field would need to be kept in one.
aws.mdAWS, an extension: SigV4 for any service, the back end's keys (its own, or a role's on EC2, ECS, EKS), SQS and a consumer, DynamoDB, Lambda, SNS and its signed messages, SES behind mailSend, Bedrock behind the ai extension, Secrets Manager, SSM, EventBridge; checking each against AWS.
gcloud.mdGoogle Cloud and Google's APIs, an extension: a service account, the metadata server or a person's token; Cloud Storage, Sheets, Drive, Calendar, Gmail behind mailSend, FCM and APNs, Pub/Sub, BigQuery, Gemini behind the ai extension, Maps.
azure.mdAzure Blob Storage (SharedKey, SAS) and Communication Services Email behind mailSend, an extension; what else of Azure would matter.
ai.mdLanguage models, an extension: Anthropic, OpenAI and Gemini behind one surface; streaming into the page or out of a route; tools and answers in the program's own types; batches, files, pictures, speech; costs, budgets, a cache, recorded replies; embeddings and a vector store; AiChat of the kit's chat parts.
twilio.mdText messages and phone codes (Verify) through Twilio, an extension; its status callbacks, signed.
slack.mdA Slack app, an extension: messages and threads, reactions, files, people and channels page by page, modals and the home tab, Block Kit as shapes; events, slash commands and interactivity, signed, answered in three seconds, done in jobs; Slack's limits.
discord.mdA Discord bot, an extension: messages with embeds, buttons and selects, channels and threads, members and roles, webhooks, slash commands; the Interactions Endpoint checked with Ed25519, deferred work in jobs; buckets and the global limit.
notion.mdNotion, an extension: a database's data sources queried with filters and sorts page by page, every property as a plain value, pages made and changed, search, a page's content read as Markdown and written from it; Notion's rate.
linear.mdLinear, an extension: issues listed with Linear's filters by cursor, made and changed, comments, teams and states over its GraphQL API; errors and the spent limit as failures; the webhook checked and each delivery done once in a job.
github.mdGitHub, an extension: repositories, files read and written, issues, pull requests, comments, reviews, checks and statuses, releases, Actions; lists by their Link header; a GitHub App's JWT and installation tokens kept; limits held for every caller of a token; webhooks checked (X-Hub-Signature-256) and done once in a job.
graphql.mdAny GraphQL API, an extension: the query and its variables, data or the errors as failures with a kind, an answer in part, a connection page by page by its cursor; what github and linear are made on.
telegram.mdA Telegram bot, an extension: messages with keyboards, files by id, address or bytes, edits, presses answered, files fetched; updates by a webhook checked by its secret token or by long polling in a job, each done once.
airtable.mdAirtable, an extension: records listed by formula, view and sort page by page, made, changed, upserted and deleted ten a request; the base's five a second and its thirty seconds after a 429; webhooks, their pings checked and each change told once.
mcp.mdThe Model Context Protocol, an extension: the program as an MCP server over Streamable HTTP (its typed fns as tools, its rows as resources, prompts, progress as events, sessions, a bearer and the Origin checked), and as a client of other servers whose tools the ai extension's loop can call.
alert.mdA line to Slack, Discord or any webhook, an extension; every fault, once in ten minutes.
sentry.mdFaults and reports to Sentry, an extension, fed by server on failure.
captcha.mdThe server's check of a Turnstile or hCaptcha token, an extension.
admin.mdThe admin extension: rule admin, AdminPanel and its pieces (people, every model's rows under its own rules, jobs, health, access, a log), acting as someone, what an admin can and cannot do.

Tools#

Building, checking, testing, and working on Mote itself.

PageWhat it answers
cli.mdmote build/dev/serve/check/test/migrate/restore/tree/editor/lsp/card/runtime, flags (check --access, --perf, --api, --against), outputs (source maps, api.json, .env.example, Dockerfile), diagnostics' ids and where they end (underlined in a terminal), project folders, mote.toml, environment.
testing.mdTests in the program (test, mote test: the back end, with its own clock, stand-ins, given env), tests/all.sh, expectations, tests/real.mjs and writing a driver, unit tests, docs/check.sh.
editor-plugin.mdYour editor in one line (mote editor vscode, or Cursor, Windsurf, VSCodium, Neovim, Vim, Helix, Emacs); mote lsp, the language server: what is wrong as you type, hover with a declaration's comment, definitions, rename, completion, the outline.
internals.mdThe compiler's passes and files, how runtime parts are chosen, batteries, adding a namespace end to end.
../runtime/README.mdThe runtime dialect: the reference for writing runtime/*.mote.
../bench/README.mdMeasurements of Mote itself: wasm fn against JavaScript in Chrome and Bun, a long feed of pictures, reading codes; each with the way to run it again.

How do I…#

TaskPage
keep a value and show itlanguage.md, markup.md
keep a list, add to it, remove from itlanguage.md, markup.md
keep something between visitslanguage.md (persist), data.md
compute something from statereactivity.md
bind a field to statemarkup.md
react to a press, a key, a pointer, a dropped file, a pasteevents.md
let the user drag one thing onto another; reorder a list by handevents.md
make a card follow the finger and throw it with a flick; know where it stands mid-transitionevents.md (swipe=), events.md (el.transform)
end a drag however the press ends (a touch taken to scroll, the page hidden)events.md (pointercancel=)
show slides one at a time, set by index, followed by a swipekit/base.md (Carousel)
keep a sheet on the page at a peek (a map's list, a player)kit/base.md (Drawer modal=false)
add a keyboard shortcut; know whether Shift is heldevents.md
hear a shortcut while the keyboard is in a fieldevents.md
a shortcut for the whole page, wherever the keyboard isevents.md
keep every fn of a file or a package on the page, said oncereactivity.md
read or set a field's selection; insert at the caret; put a menu at the caretevents.md
put a button inside something that is itself pressedevents.md
know whether the page is in front, or the person is awaymarkup.md
say what a shared link shows (title, description, picture); open the share sheetmarkup.md, data.md (share())
make a link to this page that someone else can openmarkup.md (route.link), back-end.md (route.origin)
hand a secret to a page of another site, or be handed one, after #markup.md (go("https://…/#…"), route.takeFragment())
let another site's page call a route; answer HEADback-end.md (cors=), back-end.md
do something when a value changesreactivity.md
style something; follow light and darkmarkup.md, markup.md
style on hover, or by the window's widthmarkup.md
print the page or a part of it; fill the screenmarkup.md
show one thing or another; show a listmarkup.md
have several pagesmarkup.md
make a component; pass children to itmarkup.md
use a ready-made button, dialog, table, menukit.md
open a dialog, a popover, a tooltip; show a toastmarkup.md, kit.md, language.md
search as the person types, so that only the last answer countsreactivity.md (action … newest)
load data when the page opensreactivity.md, reactivity.md
fetch from the networkdata.md
handle a failure; show "loading"language.md, reactivity.md
run something on a timerreactivity.md
keep heavy work off the page's threadreactivity.md
run a loop of numbers as WebAssembly (experimental), and see what it gainslanguage.md (wasm fn), ../bench/README.md
call a server; keep a secret off the pageback-end.md
run another program (git, a build, a test)back-end.md
call another Mote app's back end, typed, with no secret in the codeback-end.md
describe the back end to other tools (OpenAPI, a TypeScript client)back-end.md
read and write files of a folder on the serverback-end.md
go on working after a call has answered; work when the back end starts, or on a timerback-end.md
call an API that limits, refuses, or streams its answerdata.md, data.md
sign people inback-end.md
let people sign in with Googlegoogle.md
let people sign in with GitHub, Microsoft, Apple, Slack, their company's Oktaoauth.md
ask for a code from an app, or a passkeysecond-factor.md
keep a key under a passkey (the PRF extension), with or without a back endsecond-factor.md
give a public API keys and tokensjwt.md
let people sign in by a link or a code in a mailmagic.md
take payments, sell a subscription, bill by usage, pay sellers, hear Stripe's webhooksstripe.md
take payments with PayPal, or sell through a merchant of record (Paddle, Polar)paypal.md, paddle.md, polar.md
send mail (Resend, Cloudflare), keep a suppression list, write a mail in Markdownmail.md
read a mail message or an mbox, in a page or on the back end; compare addresses, find a domain's organisational domainmail-library.md
run a model on Replicate, stream its output, follow a long run across restartsreplicate.md
keep files in S3, R2, B2 or MinIO; let a browser upload straight to a buckets3.md
read and write a Postgres database (Supabase, Neon, RDS, one of your own)postgres.md
a cache, a rate limit, a lock, a queue or pub/sub in Redis or Upstashredis.md
talk to a service below HTTP (a TCP or TLS protocol), or one that streams over a WebSocketback-end.md
talk to a language model, stream its words, let it call my fns; a chat in the pageai.md
use AWS: queues, DynamoDB, Lambda, SES, Bedrock, secrets; run on a role, not keysaws.md
use Google's APIs: Cloud Storage, Sheets, Drive, Calendar, Gmail, push to phones, Pub/Sub, BigQuery, Geminigcloud.md
keep files in Azure Blob Storage; send mail through Azureazure.md
read or write XMLdata.md
send a text message, check a phone number with a codetwilio.md
make a Slack app: post with blocks, hear events, answer slash commands, buttons and modalsslack.md
make a Discord bot: slash commands, buttons, embeds, rolesdiscord.md
read and write a Notion database, a page as Markdownnotion.md
read and write an Airtable base; be told when it changesairtable.md
make and follow Linear issues from my programlinear.md
open issues, write files, post checks or answer webhooks on GitHub; be a GitHub Appgithub.md
ask any GraphQL API (Shopify, Contentful, my own), page by pagegraphql.md
make a Telegram bottelegram.md
let Claude or another MCP client call my fns; use another MCP server's toolsmcp.md
post to Slack or Discord; be told of every faultalert.md, sentry.md
check a captcha (Turnstile, hCaptcha) on the servercaptcha.md
use a service there is no extension for, without extern jsservices.md
invite someone: an account with no password, a link that proves their addressback-end.md
see how the app is used: active people, top screens, what fails, a measure of my ownusage.md
keep every event and ask it: funnels, retention cohorts, paths, new and returning, feature flags, experiments, dashboards; an event log with consumers; ClickHouseanalytics.md
count visitors, pageviews and bounces, where visits come from, the country (a proxy's header, a file of IP ranges, the time zone), browsers and devices, goals, Web Vitalsusage.md
have an admin page: accounts, every model's rows, jobs, health, "see what they see"admin.md
take an extension (usage, Google, admin) into a program; write one../extensions/README.md, ../extensions/README.md
say who may read the usage numbersusage.md (usageMay)
see several apps' usage in one panelusage.md (usageTake(batch, app), app=)
read or write a model whose name is only known as the program runsmodels.md
list the accounts; say what the back end is and stands onback-end.md, back-end.md
keep a value current across everyone's pagesback-end.md
record a voice clip; show how loud the microphone ismedia.md
play a sound; ring; say "press to turn sound on"media.md
play, pause and seek an audio or a video from the pagemedia.md
put a count in the tab's title and on the app's iconmarkup.md
show each upload's progress; cancel onemodels.md
send a notificationback-end.md, data.md
store records; query them with SQLdata.md, data.md
declare what is kept once, and read and write it with no SQLmodels.md
keep records in the browser that a list followsmodels.md
share records between people; say who may read or change a rowmodels.md, models.md
see who may do what, across every rule, server fn and route; find a rule written too openback-end.md (mote check --access)
say who may call a server fn (requires admin), with a rule a model's lines share; mark one open on purposeback-end.md
limit how often something is called; slow down password guessing; know the caller's address behind a proxyback-end.md
keep a key out of the log, and refuse to start without itback-end.md (secret("KEY"))
let support see what a user sees (act as them), safelyback-end.md (auth.as)
check a signature, or a token another service signed (a JWT)data.md
search the rows of a model by the words in them, under its rulesmodels.md
show what a person just wrote before the back end has answered; dim it until it has; take it back if it is refusedmodels.md (pending(row), confirmed)
keep what was written while offline and send it when the line is backmodels.md
make sending a call twice safe; set how long a call may takeback-end.md
test a page on a slow, lossy or dead linetesting.md
do several writes as onemodels.md
run something whenever a row is added or changedmodels.md
add, rename or remove a field once there is datamodels.md
read a file, several, or a folder the user picks; save a filedata.md
open a phone's camera; take many large files without reading them alldata.md, data.md
keep the browser from clearing what is kept; know that a disk is fulldata.md
take a page under a phone's notch and home barmarkup.md
read and write the clipboarddata.md, events.md (paste)
make bytes, write numbers into them, read a binary filelanguage.md
read or write a CSV or an Excel workbook; import a spreadsheet into a shape; export onetables.md
zip, gzip, zlib, hashdata.md, data.md
encrypt in the page before anything leaves it; exchange keys (X25519, ML-KEM-768); sign (Ed25519); derive a key from a password; a proof of workdata.md
make an invoice or a report as a PDF; read a PDF's text; fill a PDF form; merge or split PDFspdf.md
show a picture; ship an asset; use an iconmarkup.md, markup.md
resize, crop or encode a picturemedia.md
open a phone's large photo without running out of memorymedia.md
read a TIFF, a GIF's frames, a raw file's preview, a photo's Exifmedia.md, media.md
keep 16 bits; convert between colour spacesmedia.md, media.md
let the user paint; brushes, masks and layersmedia.md, media.md, media.md
show a chart (lines, bars, a pie, a heat map, a Sankey diagram …)charts.md
chart a million points; zoom, pan and brush a chart; a sparkline in a tablecharts.md, charts.md, charts.md
draw on a canvas (a game, a chart of your own)drawing.md
fill with a gradient; group shapes; add a shadowdrawing.md, drawing.md
save a drawing as a picturedrawing.md
take typing on a canvas (an editor of your own)drawing.md
draw with WebGL; run a picture through a shaderdrawing.md, drawing.md
measure text; lay out a line with a font file; get a glyph's outlinedrawing.md (draw.measure), text.md
show boxes in 3Ddrawing.md
build a 3D scene of meshes, lights and a camerascene.md
let people talk, see each other and share a screencalls.md
say who may join a call; set up STUN and TURNcalls.md, calls.md
log from the back end; find a failure by its idback-end.md, back-end.md
tell kinds of failure apart; hear every failure in one placeback-end.md
deploy: health checks, stopping cleanly, caching, a containerback-end.md, back-end.md, cli.md
use the camera; read a QR code or barcodemedia.md, media.md
play, cut and export videomedia.md
put clips on tracks; keyframe, wipe, grade; meter the soundmedia.md
match text with a patterntext.md
search text (a list the page has; for a model's rows, models.md)text.md
colour code; show Markdowntext.md
embed a code editor, a terminal, a node canvaswidgets.md
write mail: bold, lists, links, quotes, pictures, as HTML and plain textkit/richtext.md
measure or scroll an elementevents.md
split a program over files; use another project'slanguage.md, language.md
build, serve, checkcli.md
set my editor up: errors as I type, hover, go to definition, renameeditor-plugin.md (mote editor, mote lsp)
write a declaration's documentation, shown on hovereditor-plugin.md
see a file's syntax tree; know where a diagnostic endscli.md (mote tree, mote check --json)
make an installable, offline appcli.md
build the same bytes twice, and check a folder or a site against the sourcedelivery.md (mote build --check, build.txt)
show which build the app isdelivery.md (app.build())
send the page with a strict Content-Security-Policy and the other security headersdelivery.md (policy=strict, connect=)
keep an installed app on its build until the person agrees to a new onedelivery.md (update=ask)
make a page agents can useagents.md
test a pagetesting.md
test the back end: rules, hooks, server fns, jobs, with the clock settesting.md
do work later, so that it is not lost (mail, a webhook out), or at a time of dayback-end.md, back-end.md
change the rows already there when the schema changesmodels.md
show a fallback where part of a page fails (a chart given bad data, a derive that throws), with a way to try againmarkup.md (try / else err / again)
hear every failure of the page in one place; know what kind it was and where it was writtenback-end.md (on failure(f): f.kind, f.words, f.at)
say exactly which words a person sees for each kind of failure (offline, sign in, refused, limited…)back-end.md
see .mote lines in a stack, not the built JavaScriptback-end.md
add a row or change it if it is there; add one to a countmodels.md (T.put, inc)
count rows by a field; sum a field by anothermodels.md (T.count(f, {by}), T.sum)
read a setting in a rule (an admins' list in the environment)back-end.md (setting, setting.list)
know what a write sends to the pages that follow a listmodels.md
run something every night, or at 9 on Mondaysback-end.md (server at)
queue work that must not be lost, with retriesback-end.md (job fn, .in, .at, unique)
take backups of the database while it runs; restore oneback-end.md (MOTE_BACKUP, mote restore)
share one database between two appsback-end.md (MOTE_SQL), back-end.md
check two programs that work together agree (their calls, their models)cli.md (--against)
send mailback-end.md
find code that is slow on the back end (a query in a loop)cli.md (--perf)
say, in a package, a fn the program that takes it must declarelanguage.md (wants fn)
test the back end with settings of its owntesting.md (given env)
understand a compiler messagecli.md
add a namespace or a call to Moteinternals.md
add a batteryinternals.md
add a runtime partinternals.md
add a tag, an event, a widget, a kit componentinternals.md
write runtime code../runtime/README.md

Namespaces#

Every namespace of the standard library, and its page. "Waits" means the call leaves the page: it can fail, must meet else or ?, and cannot go in a derive or a binding.

NamespaceWhatWaitsIn a server fnPage
netrequests over the network; send (any status), stream (pieces, events)yesyesdata.md
procother programs: run, startyesonly thereback-end.md
tcpa connection below HTTP: open (plain, TLS, STARTTLS, a proxy), take (a pool), poolsyesonly thereback-end.md
wsa WebSocket the back end opens: openyesonly thereback-end.md
webhookanother service's webhook: check (its signature, over the bytes sent), once (each event once)yesonly thereback-end.md
dbkeys to values, in IndexedDB; persist, persisted, room: whether the site's data stays, and how much fitsyesnodata.md
sqlSQLiteyesyesdata.md
fsprivate files; open (a reader, a piece at a time) and writer; pick (one, many, a folder) and save; folderyesyes (not pick, save); folder only theredata.md, back-end.md
clipboardthe system's clipboard: text, image, putyesnodata.md
storelocalStoragenonodata.md
cryptohash (SHA-2, SHA-3, BLAKE2b), hmac, hkdf, pbkdf2, argon2id, random, randomBytes, equal; a page's own keys: aes.seal and open (AES-256-GCM), x25519, ed25519, mlkem768, powyes (random, randomBytes, equal, crc32: no)yes, all of these; sign, verify, seal, open, jwt only theredata.md, data.md
zipgzip, deflate, zlib, .zip files; entries, open, gunzipStream for large ones, a piece at a timeyesyesdata.md
tara .tar (a .tgz through zip.gunzipStream), an entry at a time: entriesyesyesdata.md
csvCSV read (typed, or a piece at a time with open) and writtenyes (write: no)yestables.md
xlsxExcel workbooks read and writtenyesyestables.md
filesa model's files: upload, sending (the page), keep, bytes, path (the back end); files.progressyes (progress, sending: no)keep, bytes, pathmodels.md
bytesbytes from text, hex, base64; new, of, joinno (hex, base64 can fail)yeslanguage.md
imgpicture codecs and edits; decode (to fit), info, frames, depth, convertyesyes (Mote's own codecs)media.md
paintpictures that are drawn onnonomedia.md
scanQR codes and barcodesyesnomedia.md
camthe camera's frame and errorshot: yesnomedia.md
vid, audvideo and sound (vid.progress, vid.levels: no)yesnomedia.md
speech, micspeech in and out, microphones; mic.record, mic.meter (a recording's stop: waits; its pause, resume, cancel: no)yesnomedia.md
sounda sound with no element: play, stop; sound.ready, sound.errornonomedia.md
rtccalls between browsers: join, devices; a call's own mute, camera, share, use, send, stats, leaveyes (send, leave: no)no (server call is its guard)calls.md
drawthe 2D pen of a surface; measure, read, picturenonodrawing.md
glthe WebGL pen of a surface gl; pen, image, filternonodrawing.md
threerecords for canvas scene=nonoscene.md
repatternsnoyestext.md
richtexta rich text document as mail: html (inline styles), text; from text, quote, apply an edit's operations, picturesnoyes (and in an off fn)kit/richtext.md
searchfull-text searchyesyestext.md
htmlHTML from elsewhere held to an allow-list (clean) or as plain text (text); the htmlframe element shows ityesyestext.md
syntaxtext to a treeyesyestext.md
fontfont files: facts, layout, outlines, subsetsyesyes (not use)text.md
pdfPDF files: make from parts (text, table, image, …), info, read, words, images, fields, fill, flatten, merge, pages, rotate, stampyes (the parts: no)yespdf.md
appthe app itself: build (the build's hash); in a page of an app that says update=ask, check and update; on the back end info, accessyesbuild, info, accessdelivery.md, back-end.md
authsigning inyesmeback-end.md
notify, pushnotifications: allowed, enable, devices, inbox; to some devices, with datayesnotify.send, notify.devicesback-end.md, data.md
elan element held through ref=; a field's caret and selectionnonoevents.md, events.md
keysmodifier keys held nownonoevents.md
screenwindow width class, size, scheme; print, fullscreen, full; visible, focused, idle(ms)nonomarkup.md, markup.md
routethe current address: path, url, origin, link(path)nono (origin only)markup.md
timea moment in a zone and a language: clock, date, words; parts, of, add, next, startOf, endOf; stamp, read; zone, zones, weekStartnoyes, the zone said (not zone)language.md

A model is not a namespace: its name is, with the operations of models.md (Note.find(…), Note.add(…)); each waits, a model's in a server fn too, a local model's only in the page.

Built-in calls with no namespace (uid, now, log, go, back, toast, copy, focus, scroll, fail, pending, failed, failure, refresh, asset, scheme, bytes; and on the back end env, changed, emit, emitTo): language.md and the pages above.

Checking these docs#

sh
docs/check.sh

extracts every fenced mote block that starts with // docs: whole and runs mote check on it (testing.md).

Adding to these docs#

Where things go (for whoever adds to these docs, or merges a branch that added lines to the old one-page card):

  • The card is a summary now. A new call does not get a line there unless most programs will want it. It goes in its topic page, under the heading for its namespace or element, and gets a row in the namespace table above if the namespace is new.
  • Where each kind of thing lives: bytes → language.md · events, keys, dragging → events.md · watch, timers, tasks → reactivity.md · draw, gl, surface, the 3D canvas → drawing.md · paint, img and picture formats, vid, aud, reel, camera, scan → media.md · files a page names → markup.md · screen, print, the whole screen → markup.md · rtc, a call, video of=, server call → calls.md · storage, the network, the clipboard → data.md · the back end → back-end.md · model, its operations, rules and schema.lock → models.md · re, search, syntax, font → text.md · pdf → pdf.md · a new element the runtime builds → widgets.md · a kit component → kit.md and its page under kit/.
  • Every topic page has the same headings: the opening example, Mental model, the subject's sections, Pitfalls, Where a new call goes (where it applies), In the source. Put a call in its section's table, add what is refused and any pitfall, and name the source file.
  • The 3D canvas's scene API (three.*, canvas scene=) has its own page, scene.md, and a brief section in drawing.md.
  • An example that can stand alone starts with // docs: whole and must pass docs/check.sh. Run it before finishing.
  • Do not describe a plan as if it were built. If it is not in the compiler in this checkout, it is not in these pages.
Edit this page:docs/README.md
esc
1072 sections of 111 pages, ranked as you type.A heading's words count for more than what stands under it.
↑↓move
↵open
ranked by BM25, in the page