dharaneesh-r 8aeb2c52d7 Share one board across the team over WebDAV
The board lived in each browser's localStorage, so all eight people had a
private copy: updating a task showed nobody else anything. Opening the site
in a second browser gave you a fresh board, which is what made the bug
obvious.

The board is now one JSON file served by the same Nginx that serves the page.
Browsers GET it and PUT it back through nginx's dav_module, so the tracker
stays a single static HTML file with no application server behind it.

  - poll every 5s with If-None-Match, so a quiet board costs a 304
  - re-read and merge immediately before every write; newest `updated` per
    task wins, which keeps two people's concurrent edits
  - deletes travel as tombstones, since a plain removal would be undone by
    the first colleague whose copy still had the task
  - daily snapshots under data/history/, kept 70 days, pruned by whichever
    browser loads first each day
  - a name per browser so changes carry who made them, plus a read-only
    Viewer role and an activity drawer
  - escape every innerHTML site, now that task text arrives from other people

Known limits, documented in the README: a save writes the whole file, so two
saves inside the read-merge-write window can still lose one, and there is no
authentication - anyone who can open the page can change anything. Both are
acceptable internally and neither is acceptable on a public host.

Needs a mounted volume at /var/www/board, or every redeploy resets the board
to the seed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-23 23:46:08 +05:30
2026-10-23 23:16:39 +05:30

KROW Tracker

The build board for the KROW Workforce rebuild. One HTML file and an Nginx container — no application server — but the board is shared: when anyone updates a task, everyone else sees it within about five seconds.

Running it

docker compose up -d --build

The volume is not optional. Without it the board lives inside the container and every redeploy resets the team's tasks to the seed.

How the sharing works

The board is one JSON file, data/board.json, served by the same Nginx that serves the page. Browsers read it with GET and write it back with PUT — Nginx's dav_module is what lets a browser save a file to a web server, so there is no application server to run.

  • Reading. Every browser polls the file every 5 seconds, with If-None-Match, so a quiet board costs a 304 and nothing more.
  • Writing. Before every save the page re-reads the server copy and merges it with its own, then writes the whole file back.
  • Merging. The same task is matched on its id, and whichever side was changed more recently wins. Each change stamps updated and updatedBy.
  • Deletes travel as tombstones (deleted: true), not removals. A plain removal would be undone by the first colleague whose copy still had the task. Tombstones are dropped after the retention window, when no such copy is left.

The honest limitation

A save writes the whole file, and nothing coordinates ten people doing it. The read-and-merge above shrinks the danger to the few hundred milliseconds between that read and the write. Two saves landing inside that window can still lose one, silently.

In practice this is rare — it needs two people saving within the same moment — and it was tested: a stale copy saved after someone else's edit kept both changes. But it is not impossible, which is the price of having no server. If the board ever starts losing work, that is the reason, and the fix is a real backend (Firebase, or the Node server in commit 45b4778).

There is no login. The name picker is a label, not authentication — anyone who can open the page can pick any name and change or delete any task. That is acceptable on an internal network and not acceptable on the public internet. If this is ever exposed publicly, put auth in front of it first.

Who changed what

The board asks once per browser who you are, then puts that name on everything you change: initials on the card, a tooltip, and the Activity drawer. The Viewer option sees the whole board, live, but the controls that write are removed — no create, no edit, no drag, no import.

The Shared / Offline dot in the top bar says whether this browser is still reaching the file. Offline, the board keeps working from a local copy and says so; changes made then are not saved for anyone else.

History and retention

data/history/board-YYYY-MM-DD.json holds one snapshot per day, refreshed as the day goes on, kept for 70 days. There is no server to run a cron, so the browsers do it: each one refreshes today's snapshot at most every 10 minutes, and the first browser to load each day deletes anything past the window.

To change the window, edit RETENTION_DAYS in team-tasks.html.

Restoring a day: download the snapshot, then use Import, which merges rather than replaces.

Layout on disk

Path What it is
/var/www/board/board.json The live board. Back this up.
/var/www/board/history/ Daily snapshots, 70 days.
/var/www/board/.tmp/ Nginx upload staging. Blocked from the web.

.tmp has to sit on the same filesystem as the board: Nginx writes an upload to a temp file and renames it into place, and a rename cannot cross a mount point. Putting it anywhere else makes every PUT fail once /var/www/board is a volume.

The directories are owned by nginx (uid 101). A named volume inherits that; a bind mount does not, so a host directory needs chown -R 101:101 first or every PUT comes back 403.

Deploying

Pushing to git does not deploy. The host has to pull and rebuild:

git pull && docker compose up -d --build

The seed in team-tasks.html is applied once, when the board file is first created. New rows added to it later are merged in by the next browser to load, keeping every status already on the board; tasks the team deleted stay deleted.

Description
No description provided
Readme 179 KiB
Languages
HTML 98.5%
Dockerfile 1.5%