Skip to content

A team app in one HTML file, no server

Replacing a shared spreadsheet with an offline page in a synced folder, and the file:// limits, sync races and signing hole found on the way.

saves, oldest first · never rewritteneditor 1editor 2editor 3two saves, two batchesindex.htmlfile:// · union by idno server, no loginFIG. 1 · APPEND ONLY, NO SERVERdrawn for this post
batches and the page · drawn for this postfig. 1

Every firm has the spreadsheet. Ours tracked bids: which pursuits were live, who owned them, what stage they were at, what they might be worth. It lived in a shared folder, it had a dozen editors, and it was the kind of file where somebody’s accidental sort would quietly ruin a month of data.

The usual answer is a web app with a database and a login. The usual problem with the usual answer is that it needs a server, an owner for the server, and a conversation with IT that takes longer than the project. I wanted to know how far I could get with none of that: one HTML file, in the same synced folder the spreadsheet already lived in, opened by double-clicking it.

Quite far, it turns out. Far enough that it replaced the spreadsheet. But the browser, the sync client and the operating system each had something to say about it first.

The page's chart builder: a form on the left choosing measure, grouping and date range, and a horizontal bar chart of pursuits by sector on the right, over a banner reading sample data, nothing here is real.
The page, on synthetic data. Everything in this screenshot is made up, including the sectors.

The constraint that shaped everything

A page opened from file:// cannot call fetch() on another local file. Every current browser blocks it, for good reasons; there are command-line flags that allow it, and none that a normal user should run. So the obvious design, a page that reads a JSON file next to it, is dead on arrival.

What a file:// page can do is load a script. <script src="data.js"> works fine. So every data file is a tiny JavaScript program whose only job is to push its contents onto a shared array:

window.DATA = window.DATA || [];
window.DATA.push({ kind: "summary", entries: [ /* … */ ] });

The page loads the summary, the sidecar with the full history, and one edits file per person, and merges whatever arrived. That one trick is the detail the whole delivery model rests on.

A synced folder containing the page, a summary file, a large sidecar and per-editor edit logs; inside the page, fetch is crossed out, script tags load each file, and a union-by-id step merges them.
Why there are script tags where you would expect a fetch.

The page cannot see the folder

The second thing a file:// page cannot do is list a directory. So it cannot discover that a new colleague has started editing and left a new log file. Nothing tells it the file is there.

The editor roster is therefore assembled from three sources. A config file supplies the spelling of names. The summary file records which editors existed at the last save. And any log file the page did manage to load, whose author is not in either list, is adopted by its id. Three partial views of the truth, merged, is as close as you get to “list the folder”.

Files arrive in whatever order they like

The folder is synced by a corporate file-sync client that mounts content on demand. When someone opens the page on a laptop that has been asleep for a week, the client starts fetching. The summary is a few kilobytes and lands first. The sidecar is several hundred kilobytes and lands a noticeable moment later. In that moment the page has a summary that references entries the sidecar has not delivered yet.

The first version treated the summary as authoritative and showed a page full of gaps. The fix is to read both, always, and union them by entry id. Nothing is trusted to be complete; everything is trusted to be append-only.

Saving without a server

Saves are immutable batches. Each save writes a new file under a hidden directory, with a verification record, and never rewrites an old one. Two people saving at once produce two batches, not one corrupted file. The page reads all of them and applies them in order. It is a tiny event log with the filesystem as the broker, and it has the property that matters: there is no write that can destroy a previous write.

Some environments, it turned out, refuse concurrent reads from the share. The loader tried sixteen reads at once, got failures, and now falls back to reading one at a time when that happens.

An earlier tool built on the same pattern taught a sharper lesson about where to keep state. It used localStorage as the source of truth, and one malformed date, written by an older version, reached a date-arithmetic call during render and threw. The page crashed, reloaded, read the same poisoned storage, and crashed again, on every boot, until someone cleared the browser profile. Every record is now validated on the way in, and browser storage is a cache, never the truth.

The confidential file protected by memory

The real spreadsheet was confidential. It was protected by everyone remembering which folder it lived in. When I started this project, that same folder was one git add . away from a repository.

Two rules fixed that. Every *.xlsx is ignored by git, with exactly one synthetic file un-ignored by its full path. And the build has an assertNoData() check that fails if the generated page carries a data payload at all, so the page can never be accidentally built with records inlined. The synthetic dataset is generated, has the same shape as the real export, and is the only thing that ever appears in a screenshot.

When one file was not enough

Eventually the page wanted things a file:// page cannot have: a proper window, an update mechanism, an admin console. So it grew a desktop shell, built with Tauri, that wraps the same HTML and serves it from a local origin where fetch works again. The shell is a few megabytes. The HTML file stays canonical; the shell is a convenience around it, not a replacement.

The shell updates itself from the same shared folder, and that is where the last finding came from. Updates are signed with minisign, which binds the signature to the installer’s bytes and the filename it was signed under. It does not bind it to the latest.json that says which version is current. So anyone with write access to the updates folder could list an older, validly signed installer as the newest version and roll every laptop back to a build with a known bug. The shell now refuses an installer whose filename does not carry the version latest.json claims, or whose signed name differs from its actual name, and the publish step refuses the same mismatch before it writes anything.

Where it landed

The spreadsheet is retired. The page is in daily use by people who have never typed a URL to reach it. There is a desktop shell for those who want one, and the HTML file for those who do not. The whole thing has no server, no database, no login and no monthly bill, and I would make the same choice again for a team this size.

I would also say this: file:// is a hostile environment with a very good reason to exist. Every limit above is there to protect users from pages exactly like mine. Work with the limits, write everything append-only, and the browser will let you build more than you expect.