The live demos run in the browser
The demos run fully in the browser, with no hosted server. They are pages of the guide under demos/, with a "Demos" section in the guide contents.
Context
Plan section 15 lists five live demos: "Every collection", a 1M-row grid with server group, pivot and live ticks, an infinite feed with two-way load, a collaborative sheet, and a kanban board. The plan put them on a hosted server: the Rails gem on a free or low-cost host, with a data reset each hour, rate limits and a read-only fallback. Open question 6 asks which host and which budget. The maintainer did not give a host or a budget yet.
The guide is a static site on GitHub Pages (joegaudet.com/ember-lattice/guide/). GitHub Pages
serves files only. It cannot run a server or a socket, and it cannot set the COOP and COEP
headers, so the guide cannot use SharedArrayBuffer.
The demos must show the real Lattice code, not a mock. A demo that shows a server that is not the Lattice server tells the user nothing about Lattice.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
The demos run fully in the browser, with no hosted server. They are pages of the guide under
demos/, with a "Demos" section in the guide contents.The server is the real protocol code in a Web Worker.
docs-app/workers/row-server.tstakes each request as a message.parseRowsRequestchecks the request against the allow-list, andevaluate(the reference implementation, ADR 0005) answers it. ADataSourceon the page (worker-source.ts) sends the requests; to a row model it is the same asfetchDataSourceover HTTP. An abort sends acancel, and the server drops a request that did not run yet.Latency is a floor, not an extra delay. Each answer takes at least 40 to 120 ms, as a network does. A request that takes longer to compute gets no added time.
The 1M-row grid uses an index and a level cache.
evaluatereads every row it gets. On 1M rows, one call took 0.6 to 2.5 s in Node 24. The demo server does what a database does:- An index on the group columns (
region,desk). A request with group keys gets only the rows of its group, not every row. A leaf block of one desk reads about 21k rows. - A cache of each group level (shortcut). The worker computes the root level, with and
without the pivot, before it says that it is ready. The ticking columns (
price,change) are not grouped or aggregated, so a tick does not make a cached level wrong. A demo that ticks a grouped or aggregated column must clear the cache on each tick. - Live ticks change a few of the rows that the page got last, and the server sends one
transaction for each group route, because
ServerRowModelfinds the rows byroute. - A button pauses the ticks (WCAG 2.2.2). The ticking cells are not in a live region.
- An index on the group columns (
The collaborative sheet uses the real
createDocServerin a SharedWorker. The doc server of@ember-lattice/serverruns with IronCalc as its engine and the op log in memory. Every window of the guide on one origin connects to the same SharedWorker, so two windows see the cursors and the formulas of each other. Each window has its own view with IronCalc in a worker, astest-app/app/sheethas. A SharedWorker port sends no close event, so a page sendsbyewhen it goes, and presence also times out.The fallback is a leader on a BroadcastChannel. A browser with no SharedWorker (Chrome on Android) uses the Web Locks API to choose one leader page. The leader runs the same doc server in a dedicated worker, and every page talks to it on a BroadcastChannel. When the leader goes, the next page gets the lock. It starts a new server from its own copy of the doc, and every page joins again and gets a snapshot.
A hosted Rails demo server stays a later option. It needs a host and a budget from the maintainer (open question 6). The demos do not depend on it.
The worker code is in
docs-app/workers/, outsideapp/. The app build puts every module ofapp/in the page bundle. A worker file inapp/ran on the page and pulled the doc server andkyselyinto the main chunk. So the Template tab of a demo shows the page code, and the "How it works" section shows the server code.
Consequences
- The demos cost nothing to host, have no rate limits and no data reset, and work offline.
- The data is per browser. Two users on two computers do not see each other. Only windows of one browser on one origin share the collaborative sheet.
- The 1M-row demo makes its rows in the worker, so the page holds only the blocks in view. The first level takes about 1 to 2 s on a laptop, in the worker. The page thread has no long task.
- The demo server is not a product. It is demo code in the guide, and
evaluatestays the reference, not a fast engine.
Hooks in the packages
The demos use two small hooks, so they have no copy of package code:
@ember-lattice/collabexportstoDoc(book): theCollabDocof aWorkbook. The fallback leader starts its new server from it.@ember-lattice/serverhas a./collabsubpath export. It has the doc server and no SQL, so the collab worker bundles have nokysely.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0025-demos-in-the-browser.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0025-demos-in-the-browser.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-02 | Joe Gaudet | Status in the Markdown file: accepted, 2026-12-02. |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0025-demos-in-the-browser.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.