# 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… Every page of these docs is plain Markdown at the address beside its name (relative to this file); the site's `/language` is `language.md`, and a heading is the same `#anchor` in it. `llms-full.txt` is all of them in reading order, in one file. `pages.json` is the same as data: each page's path, title, section, headings and text. A `mote` block whose first line is `// docs: whole` is a whole program that compiles as it stands. ## Start - [Mote: the docs](index.md): 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… - [Mote card](card.md): The language in brief: what to read first. mote card prints it. ## Language - [The language](language.md): Declarations, types, none and T?, wasm fn (experimental), logic, built-in calls, a call that can fail, bytes, files and use, packages. - [JavaScript of your own](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](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 - [Markup](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](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.…. - [The kit](kit.md): How the kit works, the everyday components, the index into kit/. - [The kit, E to Z](kit/more.md): shadcn/ui's components from Empty to Typography, as Mote's. They live in kit/more.mote (new) and kit/kit.mote (the ones that were there, reworked: what they took before they still take). The gallery is… - [richtext](kit/richtext.md): A rich text editor as an element, for writing mail and documents: bold, italic, code, links, headings, lists, quotes and pictures, with a toolbar. Its document is a value the program holds, not the page's DOM: the… - [The kit, A to D](kit/base.md): shadcn/ui's components from Accordion to Dropdown Menu (ui.shadcn.com/docs/components, the Base UI set), as Mote components: kit/base.mote, and the parts that kit/kit.mote's Button, Badge, Card, Checkbox, Avatar,… - [chat: the chat building blocks and the AI patterns](kit/chat.md): kit/chat.mote is shadcn/ui's chat primitives (Attachment, Bubble, Marker, Message, Message Scroller, Questionnaire, Trace) and its AI Elements patterns (the 21 at ui.shadcn.com/docs/ai-elements), under the original's… - [ai: the rest of AI Elements](kit/ai.md): kit/ai.mote is every AI Elements component (elements.ai-sdk.dev) that is not the chat core (kit/chat.mote) or the workflow canvas (kit/flow.mote): twenty families, under the original's part names. Gallery:… - [code: the highlighter, and the code blocks](kit/code.md): Highlight is a kit component, written in Mote over the syntax battery (text.md): what Shiki is to shadcn's and AI Elements' code blocks. kit/code.mote holds it, and those blocks over it, under their names. Gallery:… - [Markdown](kit/markdown.md): Markdown, laid out: what react-markdown (with remark-gfm) and Streamdown are to a React app. It is a component of the kit, in Mote (kit/code.mote), and it has two halves: - [flow: the node canvas, and the workflow components](kit/flow.md): flow is an element the runtime builds (runtime/page/flow.mote, part FL): what React Flow is to AI Elements' workflow components. kit/flow.mote is those components over it, under their names. Gallery:… - [editor](kit/editor.md): A code editor as an element: what CodeMirror is to a React app. Written from nothing (runtime/page/editor.mote, part ED); a page that does not use it does not carry it. - [terminal](kit/terminal.md): A terminal emulator screen: what xterm.js is to a web app, written for Mote from nothing (runtime/page/terminal.mote, part TM). It is a screen, not a shell: the page gives it bytes to show and is handed the bytes the… - [Widgets](widgets.md): editor, richtext, terminal, flow; where every built-in element is documented. - [Pages for agents](agents.md): Pages agents can use: data-mote, the mote-agent block, agents.mote, llms.txt. ## Data - [Data](data.md): persist and store, net, db, sql, fs, clipboard, crypto, zip, notifications without a back end. - [Tables](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](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 back end](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: the same build, a strict policy, updates that ask](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](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 - [Media](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](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](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=). - [Things in space: canvas scene=](scene.md): canvas scene= in full: three.* records, materials, pictures on them (map, mapSize, grain, sides), lights, the camera. - [Languages and formats](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, ), fmt.number/currency/percent/list/plural, screen.lang. - [Text](text.md): re and raw strings, search, syntax (code and Markdown), font (font files: layout, outlines), Highlight, CodeBlock, Markdown. - [PDF](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 - [Extensions](extensions.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. - [usage](extensions/usage.md): What people do in a program, and the web's own numbers (visitors, visits, pageviews, bounces, sources and campaigns, countries, browsers and devices, goals, who is here now, how fast each page loaded), in the… - [usage-forward](extensions/usage-forward.md): Posts what the runtime gathers of a program's usage (docs/usage.md) to an address of yours, for a team that keeps its numbers in another tool. Thirty lines: read forward.mote, and change it to say what your tool takes. - [google](extensions/google.md): Continue with Google, into the program's own accounts and sessions. The whole of it (the Google Cloud console's steps, what is kept, whose account someone from Google is, running behind a proxy) is docs/google.md. - [oauth](extensions/oauth.md): Sign-in with another service's word, into the program's own accounts and sessions, one provider a file; a provider's tokens kept for its API; the flows with no browser. The whole of it is docs/oauth.md. - [jwt](extensions/jwt.md): A public API's door: API keys and tokens for the program's own accounts, the keys tokens are checked with at /.well-known/jwks.json, turned over on a schedule. The keys and tokens are the back end's own… - [totp](extensions/totp.md): A code from an authenticator app (RFC 6238) as a second factor, with recovery codes, and a QR code writer. The whole of it is docs/second-factor.md. - [passkey](extensions/passkey.md): Passkeys (WebAuthn), checked on the back end: a way in that is both factors, and a second factor after a password. The page's half is built into Mote (passkey.create, passkey.get). The whole of it is… - [magic](extensions/magic.md): Signing in by a link or a six-digit code in a mail, over the mail extension. The whole of it is docs/magic.md. - [stripe](extensions/stripe.md): Payments, billing and marketplaces with Stripe, over its HTTP API: no package, and no Stripe.js unless the program takes the one optional file that draws Stripe's card form in its page. The whole of it (the calls,… - [paypal](extensions/paypal.md): Payments and subscriptions with PayPal, over its REST API: no package, no PayPal script in the page (the buyer approves on PayPal's own page). The whole of it is docs/paypal.md. - [paddle](extensions/paddle.md): Paddle Billing, a merchant of record (Paddle is the seller, and owes the tax), over its HTTP API: no package. The whole of it is docs/paddle.md. - [polar](extensions/polar.md): Polar (polar.sh), a merchant of record for software with benefits, over its HTTP API: no package. The whole of it is docs/polar.md. - [mail](extensions/mail.md): Sending mail through Resend, Cloudflare Email Service or any SMTP server, chosen by a setting, behind one mailSend; a suppression list every send consults, kept by Resend's events; bodies from Markdown. The whole of… - [replicate](extensions/replicate.md): Running models on Replicate: a prediction waited for, one streamed, or one kept as a row and followed by a job (and the webhook) until it ends; files in and out. The whole of it is docs/replicate.md. - [s3](extensions/s3.md): Files in any S3-compatible bucket (AWS, R2, B2, MinIO), with SigV4 written out: put, get, head, delete, list, uploads in parts, presigned GET and PUT for a browser. The whole of it is docs/s3.md. - [aws](extensions/aws.md): AWS from the back end: SigV4 for any service, the back end's keys (its own, or a role's by web identity, the container's endpoint or IMDSv2, kept and fetched again), and the services a product uses week to week. The… - [gcloud](extensions/gcloud.md): Google Cloud and Google's APIs from the back end: a service account's key (an RS256 assertion traded for a token), the metadata server on GCP, a person's own OAuth token, or an API key, behind one GcloudAuth that… - [azure](extensions/azure.md): Azure Blob Storage (SharedKey, a service SAS, the s3 extension's calls) and Communication Services Email behind mailSend. The whole of it is docs/azure.md. - [ai](extensions/ai.md): Language models over each provider's own HTTP API, behind one surface: Anthropic's Messages API, OpenAI's Responses API, any OpenAI-style Chat Completions API, and Google's Gemini API. Turns, streams (into the page,… - [twilio](extensions/twilio.md): See docs/twilio.md: the settings, the calls, what was checked and how to check it with the real service. - [slack](extensions/slack.md): A Slack app's back end over the Web API, and what Slack sends it as checked routes. The whole of it is docs/slack.md. - [notion](extensions/notion.md): A workspace's databases and pages over Notion's HTTP API, from the back end: rows queried and read page by page, made and changed, and a page's content as Markdown both ways. The whole of it is docs/notion.md. - [linear](extensions/linear.md): A workspace's issues over Linear's GraphQL API, from the back end, and its webhooks checked and done once. The whole of it is docs/linear.md. - [github](extensions/github.md): GitHub from the back end: REST page by page, GraphQL through graphql, a GitHub App's tokens, and webhooks checked and done once. The whole of it is docs/github.md. - [graphql](extensions/graphql.md): Any GraphQL API from the back end: a 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. github and linear are made on it. The whole of it… - [telegram](extensions/telegram.md): A Telegram bot from the back end, over the Bot API, and its updates by a webhook or by long polling, each done once. The whole of it is docs/telegram.md. - [airtable](extensions/airtable.md): A base's tables over Airtable's Web API, from the back end: records listed page by page, written ten a request, the base's limit kept, and its changes told by webhooks. The whole of it is docs/airtable.md. - [discord](extensions/discord.md): A Discord bot's back end over the HTTP API (v10), and the Interactions Endpoint as one checked route. The whole of it is docs/discord.md. - [mcp](extensions/mcp.md): The Model Context Protocol over Streamable HTTP: the program as an MCP server (its typed fns as tools, its rows as resources, its prompts), and as a client of other servers, whose tools the ai extension's tool loop… - [alert](extensions/alert.md): See docs/alert.md: the settings, the calls, what was checked and how to check it with the real service. - [sentry](extensions/sentry.md): See docs/sentry.md: the settings, the calls, what was checked and how to check it with the real service. - [captcha](extensions/captcha.md): See docs/captcha.md: the settings, the calls, what was checked and how to check it with the real service. - [postgres](extensions/postgres.md): Postgres over its own wire protocol (version 3), written out in Mote on tcp.open: no driver. The whole of it is docs/postgres.md. - [redis](extensions/redis.md): Redis over RESP2/RESP3 on tcp.open, or Upstash's REST API behind the same calls. The whole of it is docs/redis.md. - [admin](extensions/admin.md): The admin page a program needs for its own people, in the program's own back end. The whole of it is docs/admin.md. - [Analytics](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](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. - [Continue with Google](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. - [Signing in with other services: oauth](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 factors: codes and passkeys](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). - [A public API: API keys and tokens](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. - [Signing in by mail: magic](magic.md): Signing in by a link or a code in a mail, over the mail extension. - [SAML and SCIM: not here, and why](saml.md): SAML and SCIM: not built, why, what a B2B product loses, what OIDC by issuer covers, and the design they would have. - [Another service, without a package](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](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](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](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](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. - [The mail library](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](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](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](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](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](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](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. - [Google Cloud](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](azure.md): Azure Blob Storage (SharedKey, SAS) and Communication Services Email behind mailSend, an extension; what else of Azure would matter. - [AI](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](twilio.md): Text messages and phone codes (Verify) through Twilio, an extension; its status callbacks, signed. - [Slack](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](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](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](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](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](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](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](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](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](alert.md): A line to Slack, Discord or any webhook, an extension; every fault, once in ten minutes. - [Sentry](sentry.md): Faults and reports to Sentry, an extension, fed by server on failure. - [Captcha](captcha.md): The server's check of a Turnstile or hCaptcha token, an extension. - [Admin](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 - [The command line](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](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. - [The editor plug-in](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](internals.md): The compiler's passes and files, how runtime parts are chosen, batteries, adding a namespace end to end. ## This site - [Reading these docs](site/about.md): This site is a Mote app (docs/site/app.mote). Its pages are the Markdown files in docs/, and the READMEs of extensions/ (at #/extensions, #/extensions/usage, …), read by a build step and shown as they are: nothing is… ## This site as a program The site is a Mote app; a program driving a browser can press its controls. > Mote's documentation. Every page is also plain Markdown: /language is language.md beside this page, llms.txt lists them all, and llms-full.txt is all of them in one file. Read those rather than driving this page. Every control carries data-mote: the action a press runs, the state a field writes, or set-NAME for a press that sets that state. Select with [data-mote="NAME"]. Routes are addresses after #. In the page, `mote` drives it without a picture: `await mote.read()` is the page as a few lines of text, `await mote.press("add")` and `mote.type("draft", "milk")` act and come back when the page is at rest, with what changed; `mote.help()` lists the rest. The same as data: the `