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#
rustup target add wasm32-unknown-unknown # oncecargo install --path compiler # in a checkout of the repositorymote editor vscode # or cursor, neovim, helix, …mote dev app.mote # serve it, reload on saveThe 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.
state n = 0button `Pressed ${n} times` press={n += 1}mote build app.mote --single writes dist/index.htmlmote dev app.mote serves it and reloads on saveHow the pieces fit#
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--singlecarries 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 whatserver/main.jsis 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):
- Read card.md. It is short and stands alone for the common cases.
- Read language.md and markup.md once. They are the two halves of every program.
- Look up the rest when you need it, through the how do I… table or the namespaces.
- Run
mote check file.moteafter every change. The compiler's messages name the fix. Trust it over memory: it knows exactly what exists. - Do not guess a name. If a call is not in these pages, it does not exist;
mote checkwill say so, with what the namespace does have.
Three rules explain most first mistakes:
- Only an
action(or a{…}handler) writes state. Afnis pure. - A call that can fail must meet
elseor?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.
| Page | What it answers |
|---|---|
| card.md | The language in brief: what to read first. mote card prints it. |
Language#
What every program is made of.
| Page | What it answers |
|---|---|
| language.md | Declarations, types, none and T?, wasm fn (experimental), logic, built-in calls, a call that can fail, bytes, files and use, packages. |
| js.md | JavaScript 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.md | When 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.
| Page | What it answers |
|---|---|
| markup.md | Tags, 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.md | Every 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.md | How the kit works, the everyday components, the index into kit/. |
| kit/*.md | Every kit component, by family: base, more, chat, ai, code, markdown, flow, editor, richtext, terminal. |
| widgets.md | editor, richtext, terminal, flow; where every built-in element is documented. |
| agents.md | Pages 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.
| Page | What it answers |
|---|---|
| data.md | persist and store, net, db, sql, fs, clipboard, crypto, zip, notifications without a back end. |
| tables.md | csv 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.md | model 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.
| Page | What it answers |
|---|---|
| back-end.md | server 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.md | How 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.md | Calls 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.
| Page | What it answers |
|---|---|
| media.md | img (formats, deep pictures, colour), paint (brushes, layers) and canvas layers=, scan, camera, vid/aud/reel (a film's tracks, keys and grades), speech. |
| charts.md | Charts: 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.md | surface (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.md | canvas scene= in full: three.* records, materials, pictures on them (map, mapSize, grain, sides), lights, the camera. |
| words.md | Languages 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.md | re and raw strings, search, syntax (code and Markdown), font (font files: layout, outlines), Highlight, CodeBlock, Markdown. |
| pdf.md | pdf: 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.
| Page | What it answers |
|---|---|
| ../extensions/README.md | What 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.md | Every 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.md | What 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.md | Continue 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.md | Signing 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.md | Second 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.md | A 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.md | Signing in by a link or a code in a mail, over the mail extension. |
| saml.md | SAML and SCIM: not built, why, what a B2B product loses, what OIDC by issuer covers, and the design they would have. |
| services.md | Another 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.md | Payments, 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.md | Payments 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.md | Paddle 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.md | Polar, 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.md | The 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.md | Mail 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.md | Running 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.md | Postgres, 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.md | Redis, 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.md | Files 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.md | AWS, 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.md | Google 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.md | Azure Blob Storage (SharedKey, SAS) and Communication Services Email behind mailSend, an extension; what else of Azure would matter. |
| ai.md | Language 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.md | Text messages and phone codes (Verify) through Twilio, an extension; its status callbacks, signed. |
| slack.md | A 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.md | A 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.md | Notion, 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.md | Linear, 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.md | GitHub, 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.md | Any 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.md | A 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.md | Airtable, 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.md | The 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.md | A line to Slack, Discord or any webhook, an extension; every fault, once in ten minutes. |
| sentry.md | Faults and reports to Sentry, an extension, fed by server on failure. |
| captcha.md | The server's check of a Turnstile or hCaptcha token, an extension. |
| admin.md | The 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.
| Page | What it answers |
|---|---|
| cli.md | mote 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.md | Tests 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.md | Your 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.md | The compiler's passes and files, how runtime parts are chosen, batteries, adding a namespace end to end. |
| ../runtime/README.md | The runtime dialect: the reference for writing runtime/*.mote. |
| ../bench/README.md | Measurements 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…#
| Task | Page |
|---|---|
| keep a value and show it | language.md, markup.md |
| keep a list, add to it, remove from it | language.md, markup.md |
| keep something between visits | language.md (persist), data.md |
| compute something from state | reactivity.md |
| bind a field to state | markup.md |
| react to a press, a key, a pointer, a dropped file, a paste | events.md |
| let the user drag one thing onto another; reorder a list by hand | events.md |
| make a card follow the finger and throw it with a flick; know where it stands mid-transition | events.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 swipe | kit/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 held | events.md |
| hear a shortcut while the keyboard is in a field | events.md |
| a shortcut for the whole page, wherever the keyboard is | events.md |
| keep every fn of a file or a package on the page, said once | reactivity.md |
| read or set a field's selection; insert at the caret; put a menu at the caret | events.md |
| put a button inside something that is itself pressed | events.md |
| know whether the page is in front, or the person is away | markup.md |
| say what a shared link shows (title, description, picture); open the share sheet | markup.md, data.md (share()) |
| make a link to this page that someone else can open | markup.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 HEAD | back-end.md (cors=), back-end.md |
| do something when a value changes | reactivity.md |
| style something; follow light and dark | markup.md, markup.md |
| style on hover, or by the window's width | markup.md |
| print the page or a part of it; fill the screen | markup.md |
| show one thing or another; show a list | markup.md |
| have several pages | markup.md |
| make a component; pass children to it | markup.md |
| use a ready-made button, dialog, table, menu | kit.md |
| open a dialog, a popover, a tooltip; show a toast | markup.md, kit.md, language.md |
| search as the person types, so that only the last answer counts | reactivity.md (action … newest) |
| load data when the page opens | reactivity.md, reactivity.md |
| fetch from the network | data.md |
| handle a failure; show "loading" | language.md, reactivity.md |
| run something on a timer | reactivity.md |
| keep heavy work off the page's thread | reactivity.md |
| run a loop of numbers as WebAssembly (experimental), and see what it gains | language.md (wasm fn), ../bench/README.md |
| call a server; keep a secret off the page | back-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 code | back-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 server | back-end.md |
| go on working after a call has answered; work when the back end starts, or on a timer | back-end.md |
| call an API that limits, refuses, or streams its answer | data.md, data.md |
| sign people in | back-end.md |
| let people sign in with Google | google.md |
| let people sign in with GitHub, Microsoft, Apple, Slack, their company's Okta | oauth.md |
| ask for a code from an app, or a passkey | second-factor.md |
| keep a key under a passkey (the PRF extension), with or without a back end | second-factor.md |
| give a public API keys and tokens | jwt.md |
| let people sign in by a link or a code in a mail | magic.md |
| take payments, sell a subscription, bill by usage, pay sellers, hear Stripe's webhooks | stripe.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 Markdown | mail.md |
| read a mail message or an mbox, in a page or on the back end; compare addresses, find a domain's organisational domain | mail-library.md |
| run a model on Replicate, stream its output, follow a long run across restarts | replicate.md |
| keep files in S3, R2, B2 or MinIO; let a browser upload straight to a bucket | s3.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 Upstash | redis.md |
| talk to a service below HTTP (a TCP or TLS protocol), or one that streams over a WebSocket | back-end.md |
| talk to a language model, stream its words, let it call my fns; a chat in the page | ai.md |
| use AWS: queues, DynamoDB, Lambda, SES, Bedrock, secrets; run on a role, not keys | aws.md |
| use Google's APIs: Cloud Storage, Sheets, Drive, Calendar, Gmail, push to phones, Pub/Sub, BigQuery, Gemini | gcloud.md |
| keep files in Azure Blob Storage; send mail through Azure | azure.md |
| read or write XML | data.md |
| send a text message, check a phone number with a code | twilio.md |
| make a Slack app: post with blocks, hear events, answer slash commands, buttons and modals | slack.md |
| make a Discord bot: slash commands, buttons, embeds, roles | discord.md |
| read and write a Notion database, a page as Markdown | notion.md |
| read and write an Airtable base; be told when it changes | airtable.md |
| make and follow Linear issues from my program | linear.md |
| open issues, write files, post checks or answer webhooks on GitHub; be a GitHub App | github.md |
| ask any GraphQL API (Shopify, Contentful, my own), page by page | graphql.md |
| make a Telegram bot | telegram.md |
| let Claude or another MCP client call my fns; use another MCP server's tools | mcp.md |
| post to Slack or Discord; be told of every fault | alert.md, sentry.md |
| check a captcha (Turnstile, hCaptcha) on the server | captcha.md |
use a service there is no extension for, without extern js | services.md |
| invite someone: an account with no password, a link that proves their address | back-end.md |
| see how the app is used: active people, top screens, what fails, a measure of my own | usage.md |
| keep every event and ask it: funnels, retention cohorts, paths, new and returning, feature flags, experiments, dashboards; an event log with consumers; ClickHouse | analytics.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 Vitals | usage.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 numbers | usage.md (usageMay) |
| see several apps' usage in one panel | usage.md (usageTake(batch, app), app=) |
| read or write a model whose name is only known as the program runs | models.md |
| list the accounts; say what the back end is and stands on | back-end.md, back-end.md |
| keep a value current across everyone's pages | back-end.md |
| record a voice clip; show how loud the microphone is | media.md |
| play a sound; ring; say "press to turn sound on" | media.md |
play, pause and seek an audio or a video from the page | media.md |
| put a count in the tab's title and on the app's icon | markup.md |
| show each upload's progress; cancel one | models.md |
| send a notification | back-end.md, data.md |
| store records; query them with SQL | data.md, data.md |
| declare what is kept once, and read and write it with no SQL | models.md |
| keep records in the browser that a list follows | models.md |
| share records between people; say who may read or change a row | models.md, models.md |
see who may do what, across every rule, server fn and route; find a rule written too open | back-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 purpose | back-end.md |
| limit how often something is called; slow down password guessing; know the caller's address behind a proxy | back-end.md |
| keep a key out of the log, and refuse to start without it | back-end.md (secret("KEY")) |
| let support see what a user sees (act as them), safely | back-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 rules | models.md |
| show what a person just wrote before the back end has answered; dim it until it has; take it back if it is refused | models.md (pending(row), confirmed) |
| keep what was written while offline and send it when the line is back | models.md |
| make sending a call twice safe; set how long a call may take | back-end.md |
| test a page on a slow, lossy or dead line | testing.md |
| do several writes as one | models.md |
| run something whenever a row is added or changed | models.md |
| add, rename or remove a field once there is data | models.md |
| read a file, several, or a folder the user picks; save a file | data.md |
| open a phone's camera; take many large files without reading them all | data.md, data.md |
| keep the browser from clearing what is kept; know that a disk is full | data.md |
| take a page under a phone's notch and home bar | markup.md |
| read and write the clipboard | data.md, events.md (paste) |
| make bytes, write numbers into them, read a binary file | language.md |
| read or write a CSV or an Excel workbook; import a spreadsheet into a shape; export one | tables.md |
| zip, gzip, zlib, hash | data.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 work | data.md |
| make an invoice or a report as a PDF; read a PDF's text; fill a PDF form; merge or split PDFs | pdf.md |
| show a picture; ship an asset; use an icon | markup.md, markup.md |
| resize, crop or encode a picture | media.md |
| open a phone's large photo without running out of memory | media.md |
| read a TIFF, a GIF's frames, a raw file's preview, a photo's Exif | media.md, media.md |
| keep 16 bits; convert between colour spaces | media.md, media.md |
| let the user paint; brushes, masks and layers | media.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 table | charts.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 shadow | drawing.md, drawing.md |
| save a drawing as a picture | drawing.md |
| take typing on a canvas (an editor of your own) | drawing.md |
| draw with WebGL; run a picture through a shader | drawing.md, drawing.md |
| measure text; lay out a line with a font file; get a glyph's outline | drawing.md (draw.measure), text.md |
| show boxes in 3D | drawing.md |
| build a 3D scene of meshes, lights and a camera | scene.md |
| let people talk, see each other and share a screen | calls.md |
| say who may join a call; set up STUN and TURN | calls.md, calls.md |
| log from the back end; find a failure by its id | back-end.md, back-end.md |
| tell kinds of failure apart; hear every failure in one place | back-end.md |
| deploy: health checks, stopping cleanly, caching, a container | back-end.md, back-end.md, cli.md |
| use the camera; read a QR code or barcode | media.md, media.md |
| play, cut and export video | media.md |
| put clips on tracks; keyframe, wipe, grade; meter the sound | media.md |
| match text with a pattern | text.md |
| search text (a list the page has; for a model's rows, models.md) | text.md |
| colour code; show Markdown | text.md |
| embed a code editor, a terminal, a node canvas | widgets.md |
| write mail: bold, lists, links, quotes, pictures, as HTML and plain text | kit/richtext.md |
| measure or scroll an element | events.md |
| split a program over files; use another project's | language.md, language.md |
| build, serve, check | cli.md |
| set my editor up: errors as I type, hover, go to definition, rename | editor-plugin.md (mote editor, mote lsp) |
| write a declaration's documentation, shown on hover | editor-plugin.md |
| see a file's syntax tree; know where a diagnostic ends | cli.md (mote tree, mote check --json) |
| make an installable, offline app | cli.md |
| build the same bytes twice, and check a folder or a site against the source | delivery.md (mote build --check, build.txt) |
| show which build the app is | delivery.md (app.build()) |
| send the page with a strict Content-Security-Policy and the other security headers | delivery.md (policy=strict, connect=) |
| keep an installed app on its build until the person agrees to a new one | delivery.md (update=ask) |
| make a page agents can use | agents.md |
| test a page | testing.md |
test the back end: rules, hooks, server fns, jobs, with the clock set | testing.md |
| do work later, so that it is not lost (mail, a webhook out), or at a time of day | back-end.md, back-end.md |
| change the rows already there when the schema changes | models.md |
| show a fallback where part of a page fails (a chart given bad data, a derive that throws), with a way to try again | markup.md (try / else err / again) |
| hear every failure of the page in one place; know what kind it was and where it was written | back-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 JavaScript | back-end.md |
| add a row or change it if it is there; add one to a count | models.md (T.put, inc) |
| count rows by a field; sum a field by another | models.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 list | models.md |
| run something every night, or at 9 on Mondays | back-end.md (server at) |
| queue work that must not be lost, with retries | back-end.md (job fn, .in, .at, unique) |
| take backups of the database while it runs; restore one | back-end.md (MOTE_BACKUP, mote restore) |
| share one database between two apps | back-end.md (MOTE_SQL), back-end.md |
| check two programs that work together agree (their calls, their models) | cli.md (--against) |
| send mail | back-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 declare | language.md (wants fn) |
| test the back end with settings of its own | testing.md (given env) |
| understand a compiler message | cli.md |
| add a namespace or a call to Mote | internals.md |
| add a battery | internals.md |
| add a runtime part | internals.md |
| add a tag, an event, a widget, a kit component | internals.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.
| Namespace | What | Waits | In a server fn | Page |
|---|---|---|---|---|
net | requests over the network; send (any status), stream (pieces, events) | yes | yes | data.md |
proc | other programs: run, start | yes | only there | back-end.md |
tcp | a connection below HTTP: open (plain, TLS, STARTTLS, a proxy), take (a pool), pools | yes | only there | back-end.md |
ws | a WebSocket the back end opens: open | yes | only there | back-end.md |
webhook | another service's webhook: check (its signature, over the bytes sent), once (each event once) | yes | only there | back-end.md |
db | keys to values, in IndexedDB; persist, persisted, room: whether the site's data stays, and how much fits | yes | no | data.md |
sql | SQLite | yes | yes | data.md |
fs | private files; open (a reader, a piece at a time) and writer; pick (one, many, a folder) and save; folder | yes | yes (not pick, save); folder only there | data.md, back-end.md |
clipboard | the system's clipboard: text, image, put | yes | no | data.md |
store | localStorage | no | no | data.md |
crypto | hash (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, pow | yes (random, randomBytes, equal, crc32: no) | yes, all of these; sign, verify, seal, open, jwt only there | data.md, data.md |
zip | gzip, deflate, zlib, .zip files; entries, open, gunzipStream for large ones, a piece at a time | yes | yes | data.md |
tar | a .tar (a .tgz through zip.gunzipStream), an entry at a time: entries | yes | yes | data.md |
csv | CSV read (typed, or a piece at a time with open) and written | yes (write: no) | yes | tables.md |
xlsx | Excel workbooks read and written | yes | yes | tables.md |
files | a model's files: upload, sending (the page), keep, bytes, path (the back end); files.progress | yes (progress, sending: no) | keep, bytes, path | models.md |
bytes | bytes from text, hex, base64; new, of, join | no (hex, base64 can fail) | yes | language.md |
img | picture codecs and edits; decode (to fit), info, frames, depth, convert | yes | yes (Mote's own codecs) | media.md |
paint | pictures that are drawn on | no | no | media.md |
scan | QR codes and barcodes | yes | no | media.md |
cam | the camera's frame and error | shot: yes | no | media.md |
vid, aud | video and sound (vid.progress, vid.levels: no) | yes | no | media.md |
speech, mic | speech in and out, microphones; mic.record, mic.meter (a recording's stop: waits; its pause, resume, cancel: no) | yes | no | media.md |
sound | a sound with no element: play, stop; sound.ready, sound.error | no | no | media.md |
rtc | calls between browsers: join, devices; a call's own mute, camera, share, use, send, stats, leave | yes (send, leave: no) | no (server call is its guard) | calls.md |
draw | the 2D pen of a surface; measure, read, picture | no | no | drawing.md |
gl | the WebGL pen of a surface gl; pen, image, filter | no | no | drawing.md |
three | records for canvas scene= | no | no | scene.md |
re | patterns | no | yes | text.md |
richtext | a rich text document as mail: html (inline styles), text; from text, quote, apply an edit's operations, pictures | no | yes (and in an off fn) | kit/richtext.md |
search | full-text search | yes | yes | text.md |
html | HTML from elsewhere held to an allow-list (clean) or as plain text (text); the htmlframe element shows it | yes | yes | text.md |
syntax | text to a tree | yes | yes | text.md |
font | font files: facts, layout, outlines, subsets | yes | yes (not use) | text.md |
pdf | PDF files: make from parts (text, table, image, …), info, read, words, images, fields, fill, flatten, merge, pages, rotate, stamp | yes (the parts: no) | yes | pdf.md |
app | the 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, access | yes | build, info, access | delivery.md, back-end.md |
auth | signing in | yes | me | back-end.md |
notify, push | notifications: allowed, enable, devices, inbox; to some devices, with data | yes | notify.send, notify.devices | back-end.md, data.md |
el | an element held through ref=; a field's caret and selection | no | no | events.md, events.md |
keys | modifier keys held now | no | no | events.md |
screen | window width class, size, scheme; print, fullscreen, full; visible, focused, idle(ms) | no | no | markup.md, markup.md |
route | the current address: path, url, origin, link(path) | no | no (origin only) | markup.md |
time | a moment in a zone and a language: clock, date, words; parts, of, add, next, startOf, endOf; stamp, read; zone, zones, weekStart | no | yes, 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#
docs/check.shextracts 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,imgand 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 andschema.lock→ models.md ·re,search,syntax,font→ text.md ·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: wholeand must passdocs/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.
docs/README.md