1. Home
  2. Guides
  3. How it works

How it works

Updated · Markdown

For whoever extends it next: you, a developer, or your AI.

One Worker, four kinds of storage

            phones                       presenter
   /K7M4P   /@handle   /             /app/   /stage/   /console/
      |         |      |                |        |          |
      +---------+------+-------+--------+--------+----------+
                               |
                     Cloudflare Worker (src/index.ts)
        static files straight from the edge, no Worker involved
                               |
     +-----------+-------------+---------------+---------------+
     |           |                             |               |
     D1          R2                    Durable Object: Room    MCP + API
  users, decks,  slides, pictures,     one per live session:   for agents
  versions,      coded decks,          every connection,
  sessions       photos, voice notes   every answer (SQLite)
  • D1 (SQLite) holds presenters, decks (one JSON document each), every saved version, and the list of sessions. remotes holds phones paired as remotes: a pairing code works once, for three minutes, and each phone that claims one gets a key of its own the presenter can remove (only hashes are kept).
  • R2 holds files: a/ pictures and downloads, u/ coded decks, m/ the room's photos and voice notes. Everything is served with a sandboxing Content-Security-Policy.
  • A Durable Object per session is the live room. Every phone, the stage, the console and any remote hold a WebSocket to it. It decides what phones show on each beat, checks and stores answers, and rolls them up. It uses the hibernation API, so a quiet room costs almost nothing.
  • Static files (the app, the stage, the phone app, stickers, fonts) come from Cloudflare's edge without waking the Worker at all.

Brand and sites

  • brand.json holds the name, tagline, domain and pictures. npm run rebrand writes it, then public/lib/brand.js (which the app and the Worker import) and every place a page needs it before any script runs, marked with data-brand attributes. Only marked places are touched.
  • wordmark says whether the logo spells the name. Pages write the name beside a symbol only (data-brand-if="symbol" in pages, public/lib/ui/logo.js in the app), so a wordmark is never doubled. logo_width and logo_height keep its proportions while it loads.
  • scripts/brand-pictures.mjs (sharp) makes the web copies: logo.webp, the icon set in public/brand/ (512, 192, 180 for iPhones, maskable for Android), favicon.ico, share.jpg for link previews, and site.webmanifest. Every page carries the same icon links. Join links get the preview picture at their own address (an HTMLRewriter in src/index.ts), so previews work on any domain.
  • sites.json lists the sites this code runs on: account, worker, database, bucket, address. wrangler.toml is the plan for all of them and runs the laptop copy; scripts/sites.mjs writes each site's copy (.site-<id>.toml) before running wrangler for it.

The public landing page

public/index.html and public/css/landing.css form the public home page. public/lib/landing/landing.js coordinates it, lazily loading the local demos in demos.js; sound.js supplies synthesized interaction sounds. These previews use sample data and pause their ongoing work when inactive. The code box and account/early-access flows still connect to the app.

The landing-page guide records the hero tour, AI preview, video behavior, volume and timing controls, responsive rules and validation limits.

One source of truth for the deck format

public/lib/core/ is plain JavaScript that runs in the browser and in the Worker:

FileHolds
spec.jsThe deck format: themes, settings, validation, repair, beats.
layouts.jsEvery stage layout and phone view, as field lists. The parts of a video slide.
interactions.jsEvery question type: fields, answer checks, roll-ups (and split roll-ups), presets.
personal.jsQuestions that depend on who answers: who sees a screen, {name} and {question} tokens, splits.
fields.jsThe field mini-language: validation, defaults, descriptions.
patch.jsJSON Patch with id paths, merge, and exact inverses for undo.
sources.jsFolding re-imported files into a deck without losing work.
css.jsA deck's own CSS, scoped so it can never touch the app around it. An @import stays only for a font service's sheet, its address read the way a browser reads it.
sandbox.jsThe two tiers a presenter's own HTML runs in: the open stage tier and the sealed audience tier (phones). Builds each one's Content-Security-Policy.
guard.jsWhat a room is never asked for: a card number (Luhn), a password or one-time-code field.
words.jsWords that wait for the presenter: a name, a word or a question from the room with a swear word or a slur in it.
kit.jsThe library kit's import map and catalog (three.js, GSAP, and more), written by scripts/kit.mjs; merging a page's own map into it.
motion.jsTransitions as data: the built-ins, checking a design, resolving what plays.
layers.jsWords and pictures placed anywhere on a slide: their fields, checking them, and the only values of theirs that reach a style (numbers, and words from a list).
htmlmap.jsA presenter's own HTML, read closely enough to change one piece where it is: elements numbered in source order (data-jy), a run of words or an attribute changed only after it still says what the slide showed.
ids.js, templates.jsIds and join codes; the tour deck.
starters.jsStarter templates for custom slides and phone screens.
catalog.jsThe catalog agents read, generated from the above.
brief.jsThe note a presenter pastes into their own AI with a request, and the link that opens a deck.

The editor draws its panels from the same field lists the server validates with, and the agent catalog is generated from them too. They cannot disagree.

Drawing lives in public/lib/render/, shared by the stage, the console, the editor and phones:

FileDraws
slide.jsOne slide at one beat, for any screen and any size, with its layers over it. Each piece of a layout's words carries the field it shows (data-f, data-i), for the editor.
views.jsLive results: bars, pillars, the ball pit, clouds, walls, splits.
pit.jsThe ball pit's physics: a small solver that sleeps once settled.
inputs.jsWhat phones answer with.
coded.jsCoded decks and Keynote exports, in sandboxed frames (with /kit/bridge.js).
frames.jsThe documents a custom slide and a phone screen are written into: the bridge, the kit's import map and the deck's theme, and the relay that hands the frame the kit files it imports.
motion.jsThe motion engine: plays a transition with the browser's own animations (layers, pieces one by one, magic move, backwards in time for going back). Built for frames as /kit/motion.js by scripts/motion.mjs.
videos.jsOne video player per file under the slides, so the parts of a video deck play on without reloading.
camera.jsThe presenter's video: one layer beside the slides, placed per slide, gliding between places.
camera-feed.jsThe presenter's video, as pictures, for a slide whose own code draws it (Stage.camera).

public/lib/live/client.js is the one connection every screen and phone holds to the room, on a WebSocket or over plain HTTPS, and backs off when the room does not answer. Phones start on the socket and move to HTTPS after a few that fail. The stage and the console race the two (race): the socket goes first, HTTPS joins after a second and a half, and a socket that drops hands over to HTTPS at once. On HTTPS the socket is tried again, each wait twice the last, up to five minutes, and a try takes over only once the room has answered its ping. A session shown HTTPS only (settings.display: "safe", sockets: false) never tries. A hello that brings the same deck back (a switch of line) redraws nothing, so a coded slide keeps running. Big screens have a feed of their own in the room: everything their sockets are sent, each entry for presenters' screens or view-only ones, and for the public view or the console's full one (?full=1, presenters only), plus live cues from phones in batches of a tenth of a second. It is filled only while a screen reads it; one that comes back after a gap starts over from its hello. It is followed with long polls at /api/sessions/<id>/feed and spoken to at /act, let in as the socket lets them in. The stage for strict networks (/stage/safe/<id>) is the stage page under safeStageCsp (core/sandbox.js): the stage's own policy, connecting only to this site, and framed only by the owner's named sites. public/lib/live/kept.js keeps a phone's photo or voice note that did not get through, in memory and IndexedDB for a day at most, so Try again sends the same one under the same name and the room never stores it twice. public/lib/live/unsent.js keeps a phone's newest answer to each question until the room has it, in the phone page's own localStorage, for that session (the welcome's room), epoch and person, so a page the phone closed in the background sends it again when it opens, under the same request id.

Editing on the slide

The editor's preview is the slide itself, drawn by render/slide.js as on the stage, and app/canvas-edit.js adds editing on top of it:

  • A layout's words carry the field they show (data-f="title", a list's item data-i, a question's prompt data-ixp). Double-clicking one makes it editable in place (contenteditable, plain text), showing what is stored (with its *stars*), and Enter, a click away or Escape ends it. The change is one patch through the editor's store, so it saves as you go and undoes with Cmd Z.
  • Layers (core/layers.js) are picked, dragged and sized with the pointer in parts of the slide, snapping to its edges and middle and to other layers. Only the end of a drag is a patch. A bar over the picked layer sets its look. Pictures dropped or pasted onto the slide are uploaded and placed where they land (app/drop.js hands the screen the drop event).
  • A page that is a picture has its words covered rather than changed (app/pagewords.js). Where they are comes from the PDF itself where it can: the importer keeps each page's blocks of words (PDF.js text content, grouped into lines and blocks, with sizes and bold from the fonts it loaded) in words.json in the import's own folder, never in the deck. Otherwise from the picture: from the point clicked, ink that differs from the page around it is followed into a line, then into the lines above and below it of the same size. The plate and the words take the page's and the old words' colours, sampled from the picture.
  • A coded or custom slide is changed in its own code. The editor's preview runs a numbered copy of it (core/htmlmap.js instrument: data-jy="n" on every element, nothing else changed): the Worker writes it for a coded page asked for with ?edit=1 (only ever for the stage tier, never for the big screen), and the editor for a custom slide's HTML. The bridge's edit mode (kit/bridge.js, { type: 'edit' }) makes a double-clicked run of words typeable in place and says which element, which run, what it said and what it says now (edit-text), or which picture (edit-image), or a double-click on nothing (edit-empty). The editor changes exactly those characters of the source, after checking they still say what the slide showed (editText, editAttr), or changes nothing and says why. A custom slide's HTML is a patch. A coded deck's file is written over, and the store keeps the old text with the step (effects in app/store.js), so Cmd Z writes it back. app/code-edit.js is the code itself, big.

Your video

The presenter's own video is a layer of the slide frame, beside the stack of slides, never part of one (render/camera.js). Where it sits is data (core/camera.js): settings.camera for the deck, a slide's camera for that slide, and the room's state.camera ({ on, place }) for what the presenter decides live. cameraFor() resolves the three, and cameraBox() and slideTransform() turn the result into the box and the slide's own shrink, in parts of the slide, so the stage, the console's mirror and the editor agree to the pixel. Between two slides the box glides from one place to the next for as long as the slides' transition takes.

The stage opens the camera at Start, if the deck uses one (live/camera.js): any camera the browser offers, a window or screen, or a link the deck names, which every big screen plays itself. It tells the presenter's other screens what it has (cam, kept in the room's memory and said again every 20 seconds), and takes requests for another camera from any of them (cam-use), so the console picks a camera on the stage's computer from a phone. A view-only screen never opens a camera.

A phone can be the camera (live/phonecam.js, the /camera/ page). It pairs like the remote (a one time code from the console, then a key of its own, listed with the paired phones as a camera), opens its camera and calls the stage by the name the stage gives itself in its status. The call's offer, answer and network candidates pass through the room between the presenter's own sockets only (rtc {to, from, d}), tagged with the paired phone they came from, and the video goes straight to the stage, peer to peer (ICE servers from GET /api/sessions/{id}/rtc/ice: STUN, and TURN when the site has a key). The stage takes it as one more source (usePhone); another camera there sends the phone a goodbye, and removing the phone ends its picture at once. On an offline copy the call stays on the venue's network.

A slide whose place is code gets the video in its own code instead (Stage.camera in kit/bridge.js). Its frame has no origin and no camera of its own, so the page around it sends it pictures (render/camera-feed.js): the frame asks (camera-want {on, width, fps}), and while that slide is on screen, says code, and the video is on, the page plays a copy of the camera's stream that nobody sees, makes an ImageBitmap of each frame at the size asked for, and moves it into the frame (camera-frame {frame}, transferred, not copied). The frame answers each one (camera-ack), and never has more than two on their way, so a deck busy for a moment skips pictures rather than piling them up. camera {on, width, height, mirror} says when that changes. The bridge draws each picture on a canvas whose stream plays in a video element: Stage.camera.video, ready for a three.js VideoTexture. A coded deck's frame is heard only while its bridge is listening, so a page it followed a link to never asks; a slide on its way out, or any slide that does not say code, gets nothing. The console's mirror and the editor's preview do the same with their own camera (the same computer's, or the one being tried). Phones never get any. A page says where the video goes with data-camera (or camera in its slide list), checked on import by pageCamera(); a page can never name the video itself (src) or mirror it, which are the deck's.

Going live online

The stage sends the talk out through Cloudflare Realtime, an SFU at Cloudflare's edge (src/realtime.ts), and everybody the room knows can watch it from the join link (live/watch.js on the phone page).

The program. Everything the room sees on the stage sits in one element, #program: the slide frame with the presenter's video, the reactions, the black screen, the big join code, the spotlight, the corner. What only the presenter sees (notes, the slide list, the keys, prompts) sits outside it. The stage captures its own tab (getDisplayMedia, this tab only) and, in Chrome and Edge 132 and later, restricts the capture to #program (Element Capture): what lies over it never goes out. Elsewhere the whole tab goes out, and the stage keeps those private screens closed while live. The sound is the presenter's microphone and the tab's own sound, mixed. The picture goes out in three layers (simulcast: f, h, q), its content hint following the slide: detail for words, motion while the video fills the screen (live/broadcast.js).

Publishing. The presenter, signed in (a key cannot): POST /api/sessions/{id}/live/ice for ICE servers, then /live/start with the offer. The Worker opens an SFU session, publishes the tracks as program and voice, and tells the room (/live-feed). The room keeps the feed (SFU session, track names, mids) in its own storage, never sent to phones, and sets state.live { on, watch, v }, which phones see in their view. v counts broadcasts: a stage that reconnects publishes again, the old one is stopped, and phones pull the new one.

Watching. A phone asks POST /live/{code}/watch with its own key. The room decides (a person it knows, not removed, while live, eight tries a minute). The Worker opens an SFU session for that person, pulls the broadcast at the layer asked for (falling back to a smaller one when the line cannot take it), keeps the session in the room's viewers table, and returns the SFU's offer with a signature (HMAC of the room, the person and the SFU session). The answer (/watch/answer), a change of layer (/watch/layer, no new SDP) and leaving (/watch/leave) carry that signature, and the room checks the session is still theirs. Phones say they are still watching every minute (watching), and the presenter's screens hear how many are (live {watching}).

Stopping. Removing a person, a new broadcast, stopping (the console, an agent, the browser's own Stop sharing) and ending the session each close the tracks concerned at the SFU at once, with no SDP (closeTracks, forced). The secret never leaves the Worker; without REALTIME_APP_ID and its token, and on an offline copy, none of this is offered.

MessageWhoWhat
live-askpresenter to room to presenteranother screen asks the stage to ask for a click or a key, to go live
control {action: 'live', on: false} / {watch}presenterstop; who watches (everyone, tap)
live {live, watching}room to presenterhow many watch
watching {on}phonestill watching, or not

Adding a question type

Say, ranking: drag options into order.

  1. public/lib/core/interactions.js: add TYPES.ranking with fields, check(ix, value) (is this a valid order?), aggregate(ix, rows) (average position per option), views (['bars'] to start) and sample(ix). Add a preset to PRESETS if it deserves a tile.
  2. public/lib/render/inputs.js: add INPUTS.ranking(host, ctx), the phone screen. Call ctx.send(value) when they are done.
  3. public/lib/render/views.js: a new view only if none fits.

That is all. The Worker, the live room, the editor, validation, the agent catalog and the MCP tools pick it up from those files.

Adding a layout

  1. public/lib/core/layouts.js: add it to LAYOUTS with fields, steps(stage) and make().
  2. public/lib/render/slide.js: add its HTML to HTML, sized in cqw and cqh, with data-s="n" on whatever lights up on beat n.
  3. public/css/slide.css: its styles, using only theme variables.

The editor's insert sheet and Screen tab show it automatically.

The live protocol

Messages are small JSON objects on one WebSocket.

FromMessage
phoneanswer {iid, value, rid}, vote {item, on}, react {k, n}, name {name}, unsend {item}, signal {k, d}, watching {on}, sync
presentergoto {slide, step, nonce}, nav {dir}, control {action, ...}, broadcast {k, d}, names {q}, sync, cam {status}, cam-use {source}, cam-ask, live-ask, rtc {to, from, d}
room to phoneswelcome, view {seq, view, spread} (with live {watch, v} while the talk is live online), ack {rid, ...}, agg, clear, epoch, deck, crowd, signal {k, d}
room to screenshello, state, agg, people, cheer, deck, play, signal {k, d, from}, names, remotes, and to the presenter's own only: cam {status} (with the stage's live), cam-use {source}, cam-ask, live-ask, live {live, watching}, rtc {to, from, d, remote}

Live signals are cues kept nowhere. A phone screen's Room.emit is a signal to the presenter's screens, with from, a short stable tag for that phone; the big screen's Stage.broadcast (or an agent's broadcast command) is a signal to every phone. Names are letters first, up to 32, and the data is JSON up to 512 bytes. A phone sends at most 15 a second and the big screen 20; a phone's signal is dropped while the room is paused, or if a string in it is a word the room would filter.

A view meant for only some people carries when and otherwise; every phone gets the same view and picks its own branch, and the room picks the same way before it keeps an answer. Results split by an earlier answer travel as agg under question@by.

src/room.ts handles everything in handle(). Phones that cannot hold a WebSocket (some venue networks break them) send with /live/CODE/act, through the same handle(), and follow /live/CODE/events: the room's numbered feed of every message to phones, read with long polls. A read answers at once with what came after the last one, or waits for the next message, or 25 seconds; a phone that is new, behind, or from before the room restarted (another era) gets what phones see now. They hear what phones with a socket hear, and a quiet room costs one request a phone every 25 seconds. A busy room answers its waiting phones together, at most once every 2.5 ms per phone following (a second for 400, at most five), so a room where every phone is on HTTPS stays near 400 requests a second, and a burst of cues is one answer. A phone moves there after three sockets that fail at once, or one held open in silence for six seconds. (/live/CODE/view stays for pages from before.)

From 250 people (CROWD), the room tells phones to show still stickers: 15 KB a phone instead of 228 KB, on a Wi-Fi a whole room shares.

The stage moves the moment a key is pressed and tells the room after, with a nonce so its own echoes are ignored. If the network drops, the talk carries on and the room catches up on reconnect.

Security, briefly

  • Passwords: PBKDF2-SHA256. Sessions and agent keys are random tokens, stored only as hashes.
  • Browser requests that change anything must carry the app's own header, so other sites cannot forge them.
  • Every user file and every coded deck is served sandboxed, with no origin, so even hostile HTML or SVG cannot reach anybody's session.
  • Custom HTML runs in sandboxed frames and talks only through postMessage bridges (/kit/bridge.js, /kit/phone.js). There are two tiers (core/sandbox.js). The stage tier, on the presenter's own machine (the big screen, the console, the editor), is open inside the frame: any library from any CDN, but no popups and no downloads, in coded decks and custom slides alike. The audience tier, on phones, is sealed: served at /p/ with a strict per-request Content-Security-Policy that lets a page reach only the self-hosted library kit (/vendor/kit/, built by scripts/kit.mjs), the deck's own files and a font service. No fetch, picture, socket, form or navigation reaches another site, so whatever a presenter's screen asks for, anything typed into it can go only to the room. The phone page may frame only /p/, and nothing under /p/ redirects, so a screen cannot slip its frame to a looser policy.
  • The room is the last gate on what the audience sends (core/guard.js): a payment-card number, or a field named like a password or a one-time code, is refused, and a phone screen asking for one is never served. Every custom phone screen also carries a line, which it cannot hide, saying never to type a secret into it.
  • The big screen sees public roll-ups only: a filtered word and a hidden name stay on the moderation console and never reach the projector, or a coded or custom deck drawing the answers there. The console is sent the public roll-ups too, worked out by the room beside its own, and a custom slide it shows gets only those.
  • A presenter's phone screen is told the person's own name (Room.me.name) only while the room shows it. A filtered, hidden or removed name reaches no screen, and the room never sends a phone anybody else's.
  • A deck's CSS is scoped to the deck (core/css.js). The one way out of the scope, @import, is kept only for a font service's sheet over https, and only when its address is written plainly: no escapes, so what is checked is what the browser fetches.
  • What a phone says in its own voice (the line under a presenter's screen, where a link really goes, asking to use the tilt, a refused card number) lives in ui/trusted.js: a closed shadow root in the browser's top layer, its host's styles pinned with !important from inside, outside the part of the page a deck's CSS can reach. A deck can restyle every question, never those words.
  • Transitions a deck designs are data (core/motion.js): checked on save against a list of visual properties, with url(), braces and semicolons refused and every time clamped, and played with Element.animate, which takes values, never code. Code that moves things runs only inside a sandboxed frame: a coded deck, a custom slide, a phone screen.
  • Phones never see speaker notes or a quiz's answer before it is revealed.
  • Photos are shrunk on the phone before upload, which also strips location data. The room's photos and voice notes are served private: never kept by a shared cache, so deleting a session deletes them everywhere.
  • MCP takes a key, never a cookie. A cookie opens the presenter's socket only from this site's own pages.
  • A second screen's link (the session's screen token) is view-only wherever it is opened. It is read before the presenter's cookie, on the socket and over HTTPS (src/live.ts), so a screen that promises to change nothing never can, and never pushes its own place back to the room. It starts by itself, with sound and full screen in its corner (screenTip in app/stage.js).
  • Sign-in limits count an IPv6 address by its /64. A browser that has signed in to an account before is counted on its own, so strangers' guesses never lock the presenter's own laptop out (known_browsers). Without email, "Forgot your password?" keeps a request (reset_requests) for an account that exists, answering the same either way and limited like the email it replaces; the owner approves it under Admin, which makes the usual one-hour, single-use link for the owner to send. The audience path has no per-address limits (a venue is hundreds of phones behind one address); only different wrong codes count, 300 a minute per place, so a script cannot hunt for live rooms, while a whole room typing the same stale code counts once.
  • Room safety. public/lib/core/words.js filters words, questions and names with a swear word or slur (English, Hinglish, some Devanagari, seen through l33t, spacing and stretching): each waits for the presenter's OK; the room stores why in the item's meta. A custom screen's answer is read the same way, every string and key in it, and a filtered one is kept for the console and left out of every public roll-up until the presenter shows it. The words of a poll's own option (other) are an item of the poll, one per person, refused if they hold a card number and filtered like any words; words the presenter hid stay hidden whatever that person writes next. A tapped word (suggestions) is sent as typed, so it goes the same way. The deck's switch and each question's own ("Filter bad words") must both be on for a question's answers to be filtered; the deck's own words wait regardless. A filtered or hidden name shows as "Guest 12" wherever names are public (people.hidden: 1 filtered, 2 hidden by the presenter). The presenter can remove a person (people.removed: their answers, items, votes and files go, their sockets close with 4403 and the reason), pause answers (state.paused, also on phones' view) and close the room to new people (state.locked).

Offline mode

The same Worker, run on the presenter's computer for a venue with bad internet or none: built into one minified file (the bundle wrangler deploy uploads) and run by Miniflare on workerd, Cloudflare's own runtime. It starts in a fraction of a second, and the desktop app ships the same file, never the source. The full design is design/OFFLINE-MODE.md; the presenter's guide is Offline mode.

 phones ──venue Wi-Fi──> audience door ──> the copy (the same Worker)
                         offline/door.mjs   listens on localhost only,
                         an allow list:     its own D1, R2 and rooms
                         join, phone page,  in .offline/
                         the room's socket        ^
                                                  | localhost
                                       the presenter's browser
  • Two doors. The copy listens on this computer only: the presenter's door. Phones come in through the audience door (offline/door.mjs), which passes on only what a phone needs and answers 404 to everything else: no app, no API, nothing a cookie opens. It sends each request on with the phone's own address, and without any cookie, Authorization or header a phone could pass itself off with. The presenter's phone as the clicker and a second screen come in the same way as online, with their keys.
  • Two addresses. The copy calls itself by the venue address (Miniflare's upstream), so join links and the QR name what phones reach, while the presenter's own screens stay on localhost (originsOf in src/live.ts, meta.origin in the room).
  • Linking a computer. It shows a code; the presenter allows it in the app; it collects a key of its own with scope offline, which reads that presenter's decks and files and brings rooms back, and is no key at all anywhere else (SCOPES in src/auth.ts).
  • Copying. offline/prepare.mjs copies the account (the same ids), the decks and every file they use into the copy, with its own secret (OFFLINE_SECRET, src/offline.ts). Again, only what changed.
  • Bringing rooms back. The room packs every row it keeps (src/room-dump.js); the cloud checks every field before it keeps any, unpacks it into the session's own room, ended, and asks for the photos and voice notes it does not have. An ended room then leaves the computer.
  • Off on a copy: sign ups, keys, emails, the AI tools and fetching from the web (CLOUD_ONLY in src/index.ts).
  • The desktop app (desktop/, Electron, one code base for Mac and Windows). desktop/src/engine.mjs does everything (link, decks, copy, start, stop, sync) on top of offline/, and runs in plain Node for tests; main.mjs is the glue: the windows, the keychain (the key is kept encrypted by the system, never in a file as text), the stage on the second display, sleep kept off while the room runs. Every window is sandboxed with context isolation; only our own pages load in them, and the control window reaches the app through one channel and a short list of calls. desktop/build.mjs stages only what the app runs: the minified Worker (no source map), public/, the migrations, Miniflare and workerd. The runtime and what it reads sit outside the app's archive, where a program can run; MINIFLARE_WORKERD_PATH points Miniflare there.

The library kit, and why the page hands it over

scripts/kit.mjs builds the kit in one pass, with shared chunks, so every library that needs React (or three's core) gets the same copy; CommonJS packages are given their names one by one; three's whole examples/jsm tree is there as three/addons/.... Inside the kit, files name each other @kit/<path>, never by a relative path, and graph.json says which file needs which.

A frame with no origin of its own never reuses the browser's cache (measured: every new frame downloads a module again). So for a custom slide and a phone screen, the page around the frame, whose cache works, fetches the kit files the author's code imports (render/frames.js) and sends their text with the document; kit/frame.js makes each a blob: module and points the import map at it. A phone downloads three.js once a talk, not once a slide. Coded decks load once and stay loaded, so they fetch by address.

Moving between slides

render/motion.js plays a transition (core/motion.js) on layers: the leaving and arriving slide, and the coded deck's frame and the video under them when those change too. The layers over a coded deck's frame catch the pointer, so a click on the edge moves the show. Only while the deck or the slide allows the mouse (settings.mouse, stage.mouse, off by default, core/spec.js codedMouse) and its bridge is listening do they let it through (css/stage.css), so the deck takes the mouse, trackpad and pen; the app's own controls stay above. A frame is listening once its bridge says ready, until it loads again (render/coded.js). A page the deck linked to is not: it hears no answers, takes no pointer, and the keys come back to the stage. A move going back plays backwards in time unless it has its own back. A press while a move plays ends that move at once and starts the next, so slides never stack. A coded deck's own pages play the same definitions through /kit/motion.js in its frame, with magic move between data-morph pieces, and Stage.transition(fn) for code of its own.

Limits worth knowing

  • A deck: 500 slides, 300 questions, about 1.5 MB of JSON.
  • A session: one Durable Object. Comfortable into the thousands of phones; results reach phones at most every 1.5 seconds (a little slower above a thousand phones, 3 seconds at 2000) so a big room stays light. Phones are sent at most 40 items of a list. After a drop, phones come back spread over 2.5ms per phone in the room (spread, at most 8 seconds), about 400 a second, under what one Durable Object takes. A session makes room for 50,000 people, at most 10,000 new ones from one network (an address, an IPv6 /64, and its /48 as well), and keeps 4 GB of photos and voice notes.
  • One phone: 25 messages a second, and 180 writes a minute (answers, votes, names, taking back); the same vote or name again writes nothing. The whole room's cues to the big screens: 500 a second. A quiz or a guess whose right answer is revealed takes no more answers.
  • A name, a word or a question with a link, an email or UPI address, or a phone number waits for the presenter, as one with a swear word does.
  • A phone keeps anything the room has not acknowledged and sends it again on the next line, for five minutes; the room takes a repeat as the same answer. Its newest answer to each question also outlives the page: at most 20 answers of 8 KB each.
  • A custom question's roll-up carries its newest 50 answers to every screen on every answer, unless its latest says fewer; with 0, only the count.
  • Uploads: pictures 25 MB, videos 95 MB, PDFs and zips 60 MB, coded deck files 25 MB each, phone photos 12 MB, voice notes 6 MB. Each presenter has 2 GB unless the owner says otherwise.

Tests

npm test          # the deck format, patches, question types, transitions, the sandbox tiers, the live room, room safety, the brand
npm run test:setup  # setup and deploy, against a pretend Cloudflare
npm run dev       # in one terminal
npm run test:live # in another: accounts, decks, a live room with six phones, MCP
npm run test:offline  # also with npm run dev: offline mode end to end, PHONES=1500 for a crowd
npm run test:desktop  # also with npm run dev: the desktop app's engine, as its buttons drive it
node test/desktop-smoke.mjs  # the app itself, windows hidden, a picture of every screen
PHONES=300 node test/load.mjs   # a crowd: 300 phones join and answer at once
npx playwright-core install chromium webkit firefox   # once, for the browser tests
npm run test:browser  # also with npm run dev: the sealed phone tier, the library kit, the Stage bridge, phone screens, the stage, in a real browser
npm run dev:live      # instead of npm run dev: going live, through a stand-in SFU (test/fake-sfu.mjs)
npm run test:golive   # with npm run dev:live: the stage goes live, a phone and a laptop watch, removing, stopping
BROWSER=webkit npm run test:browser   # the same in Safari's engine; BROWSER=firefox for Firefox
npm run check     # writing style and file weights

All guidesJoocy homePrivacyTerms