Back end
Running it
Accent
Scheme
Backdrop motion
Back end

Running it

What a back end does that is not drawn: what it logs, how it is watched and stopped, where a fault was written, how it is kept safe and shared, how it is described and tested. Each card is the code and what you would see, taken from this playground's own back end.
LogsOn stdout, one line of JSON each: a line per call (with its status and how long it took), per route hit, per job run, and whatever the program says with log.info, log.warn, log.error. Each call has an id, sent by the page and given back: a fault tells the page that id, and the log has the rest under it. MOTE_LOG=debug|info|warn|error|off; what secret() gave is written [secret].
what this playground's back end wrote (four lines of its log)
{"time":"2026-11-20T18:03:31.757Z","level":"info","msg":"listening","address":"http://localhost:6543"} {"time":"2026-11-20T18:03:31.763Z","level":"info","msg":"migrated","block":"migrate (backend_data.mote:109)","name":"pg-tally-likes"} {"time":"2026-11-20T18:03:08.250Z","level":"info","msg":"call","call":"backendPing","id":"7738c17cff54b84c8985b677","status":"ok","ms":0} {"time":"2026-11-20T18:03:13.052Z","level":"warn","msg":"job","block":"job pgBrewJob","id":"7e979ca02ac3ffa5df4f2340","job":"pgBrewJob","tries":1,"ms":0,"from":"1d6a21f12ebfe5ca9af8a9cf","status":"said","words":"the kettle for tea is cold"}
HealthGET /healthz is 200 while the back end is up; GET /readyz is 200 once it takes calls, and 503 once it is stopping. This card asks both now, with net.text.
okGET /healthz
okGET /readyz
asked 1 time
StoppingSIGTERM: /readyz says 503, no new connections, the calls in flight finish (MOTE_STOP_MS, 10 s), each server stop block runs, the pages are told and come back to the next back end within MOTE_BYE_MS (1 s), a snapshot is taken if snapshots are on, and it exits 0.
what this playground's back end wrote, stopped with snapshots on
{"time":"2026-11-20T18:03:40.610Z","level":"info","msg":"stopping","signal":"SIGTERM"} {"time":"2026-11-20T18:03:40.626Z","level":"info","msg":"snapshot","at":"2026-11-20T18-03-40Z","words":"taken as the back end stops"} {"time":"2026-11-20T18:03:40.630Z","level":"info","msg":"stopped"}
Where a fault was writtenmote build writes server/main.js.map and server/page.map beside the back end (never served). A fault's stack is read through them: each frame names the .mote file and line, the runtime's own frames folded. The page's own faults are told to its back end too, with f.at (the Failures & try page has one to press).
the log line for the fault the Rules & failures page makes (Try, under fault)
{"time":"2026-11-20T18:02:00.306Z","level":"error","msg":"fault","call":"pgBreaks","user":"197764de-…","id":"8514f025f207372da5786438", "where":"call","words":"null is not an object (evaluating 'null.first')","at":"pages/backend_guard.mote:50", "stack":"TypeError: null is not an object (evaluating 'null.first')\n at pgBreaks (pages/backend_guard.mote:50:3)\n in Mote's run…"} # and the page was told only: pgBreaks could not be done (id 8514f025f207372da5786438)
SnapshotsEvery database is kept in WAL with a busy timeout, safe for several processes. With MOTE_BACKUP the back end takes a snapshot of each, a folder a time, keeping the last so many; one is taken as it stops. mote restore puts one back, with the back end stopped.
this playground's data folder after a start and a stop with MOTE_BACKUP="backups?every=1h&keep=3"
data/ app.sqlite app.sqlite-wal app.sqlite-shm backups/ 2026-11-20T18-03-32Z/app.sqlite taken a second after it started 2026-11-20T18-03-40Z/app.sqlite taken as it stopped
One database for several appsMOTE_SQL names a folder several programs keep their models in. Each declares the models it shares (in a package both use); a write in one is in the other's live lists; readonly says an app only reads a model; server every … once runs in one of them. mote check --against compares two programs' models before either is deployed.
Not run here: it takes a second program at the same database. tests/all.sh real_shared_db runs two.
Another back endThe program that answers marks the fn requires peer: to anyone else it is a 404. The one that calls declares it with extern server fn: typed, signed with MOTE_PEER_SECRET (the same on both; new,old to change it), its answer checked against the type, the other's fail words and kinds carried across.
Not run here: it takes a second back end. tests/all.sh real_peer_calls runs two.
Describing the back endmote build writes dist/server/api.json beside the back end (never served): its calls with their requires and types, the externs, models, shapes, events, routes, rules, settings and secrets by name. mote build --api adds openapi.json and a typed client.ts for another program to call it.
the start of this playground's api.json
{ "mote": "0.1.0", "build": "5685925b1f4b2bf8", "calls": [ {"name": "backendPing", "live": false, "requires": "anyone", "params": [], "returns": "string"}, { "name": "backendQuote", "live": false, "requires": "anyone", "params": [{"name": "item", "type": "string"}, {"name": "qty", "type": "number"}], "returns": {"shape": "BackendQuote"} }, {"name": "backendVisit", "live": false, "requires": "anyone", "params": [], "returns": "number"}, …
Who may do whatmote check --access prints the table of who may do what: each model operation, call, route and room with its rule written out and who that admits, the back end's own work, the runtime's doors, then what is worth a look. Facts: it exits 0.
part of what it says of this playground
RULES (a named test: a model's line and a `requires` may both name it) pgMember = exists(PgMember, {who: me}) (backend_guard.mote:17) named by pgClubWord admin = me.email in setting.list("PLAYGROUND_ADMINS") (backend_guard.mote:21) named by pgAdminWord CALLS (POST /rpc/<name>; a `server fn` reads and writes models with no rule asked, unless marked `as me`) pgDataHit(slug: string): PgTally requires anyone: open to anyone on the internet, and says so · limit 30 per minute (backend_data.mote:99) writes PgTally pgClubWord(): string requires pgMember (backend_guard.mote:36) requires, written out: exists(PgMember, {who: me}) THE BACK END'S OWN WORK (no door: nobody calls these) migrate "pg-tally-likes" (backend_data.mote:109) writes PgTally job fn pgBrewJob (backend_work.mote:27) writes PgBrew · reads PgBrew · 1 `fail` server at "03:00" (backend_work.mote:55) writes PgBrew
mote testtest blocks, in any file, are the back end's own tests: each a fresh back end and database, a line asks as a page would (through requires and the rules), as says who, clock moves the one clock, run jobs runs what is due, given env and given net stand in for the world. No browser. This playground has seven, in pages/backend_tests.mote.
mote test examples/playground/app.mote
ok a note the back end refuses is not kept ok the club's word is for its members ok the admins are who the setting says ok three calls a minute ok put adds the tally once, inc adds to it ok a brew that fails is tried three times, then given up on ok brews older than a day go at three in the night 7 tests: all ok
esc
Pages
StartStart
Buttons & badgesComponents
Cards & disclosureComponents
Dialogs & drawersComponents
Menus & commandsComponents
Dates & tablesComponents
ChartsComponents
Chart galleryComponents
FieldsComponents
ChoicesComponents
DisplayComponents
NavigationComponents
Popovers & sheetsComponents
MessagesChat & AI
Prompt inputChat & AI
Reasoning & toolsChat & AI
Developer partsChat & AI
ConversationChat & AI
Code artifactsChat & AI
VoiceChat & AI
Code blocksChat & AI
MarkdownChat & AI
EditorElements
TerminalElements
FlowElements
3D boxesElements
PaintElements
SurfaceElements
MediaElements
IconsElements
PrimitivesElements
SQLBatteries
StorageBatteries
Net & resourcesBatteries
Crypto & bytesBatteries
ZipBatteries
TablesBatteries
PDFBatteries
TimeBatteries
ImagesBatteries
ScanBatteries
Video & audioBatteries
SearchBatteries
SyntaxBatteries
PatternsBatteries
NotifyBatteries
ShareBatteries
State & logicLanguage
WorkersLanguage
Events & elementsLanguage
StylingLanguage
RoutesLanguage
ShortcutsLanguage
Long listsLanguage
Failures & tryLanguage
Back endBack end
Models & writesBack end
Rules & failuresBack end
Jobs & schedulesBack end
Running itBack end
ExtensionsBack end
AIBack end
AnalyticsBack end
AboutAbout
↑↓move
↵open
676 places · ranked by BM25