Architecture / Active Blocks

How a Playground Stays in Sync

Two Firestore paths, one sandboxed runtime, zero network egress from generated code.

BROWSER Your browser renders the room, holds the iframe BROWSER A friend's browser same room, same event log either participant can save code or publish an event FIRESTORE DOCUMENT sandboxes/{id} the code one full HTML/JS source string FIRESTORE SUBCOLLECTION playgrounds/{id}/events the actions, ordered one doc per completed action code changes reload the sandbox from scratch onSnapshot, capped at 25/sec, 64KB per event SECURITY BOUNDARY RUNTIME Sandboxed iframe sandbox="allow-scripts" connect-src disabled: no fetch, XHR, WS jointSession.publish / .subscribe Late joiner: same buffered log flushes on the iframe's own onLoad, replay: true - so a room joined mid-session reconstructs state through the exact same handlers.