- HTML 95.5%
- JavaScript 4.5%
| bookmarks.json | ||
| bookmarks.json.bak | ||
| CLAUDE.md | ||
| embed.js | ||
| index.html | ||
| README.md | ||
| server.js | ||
| server.log | ||
Bookmarks dashboard — project notes
A self-hosted bookmarks / services page for the homelab: one page
(index.html) backed by one data file (bookmarks.json), with an optional
local server for editing. No framework, no build step, no external
dependencies beyond Bootstrap (loaded from a CDN) and Node's own built-ins.
Files
| File | What it is |
|---|---|
index.html |
The page itself. All CSS and JS live inline on purpose, so the file can be moved around on its own. |
bookmarks.json |
The data — the single source of truth for every bookmark/service. |
server.js |
Optional local server (Node, no dependencies). Serves the page and also exposes a save endpoint, which is what makes editing possible. |
embed.js |
Bakes the current bookmarks.json into index.html as a read-only fallback snapshot, for browsers that block file:// fetches. Run automatically by server.js after every save. |
docs/ |
This folder — project notes and a copy of Claude's memory about it. |
Running it, three ways
- Double-click
index.html(file://). Works in every browser. What it shows depends on the browser: Firefox fetchesbookmarks.jsondirectly (read-only, always current); every other browser (Chrome, Edge, Safari, ...) blocks that outright, so it falls back to the snapshot baked into the file byembed.js— read-only, and only as fresh as the last save made throughserver.js. - Any static file server, e.g.
python -m http.server 8000then openhttp://localhost:8000/. Same as Firefox above, but in any browser: read-only, always current (readsbookmarks.jsonfresh on every load). node server.js, then openhttp://localhost:8000/. The only way to edit. Serves the same files, plus a save endpoint. The edit controls (pencil icons, "New service", ...) only appear once that server answers — there is no local cache to fall back on.
Architecture
Loading (load() in index.html)
Three tiers, tried in order, each one the fallback for the one before it:
GET /api/bookmarks— only answers ifserver.jsis running. Readsbookmarks.jsonstraight off disk on every request. This is the only tier where edits can be saved.GET bookmarks.json(fetched directly) — works from any other static server, and fromfile://in Firefox specifically. Read-only, but always current.EMBEDDED_SNAPSHOT— a copy of the data baked directly intoindex.html's own JS. The only tier that works whenfile://is blocked outright (Chrome, Edge, Safari, ...). Read-only, and only as fresh as the last save made throughserver.js(or the last manualnode embed.js).
The page shows which tier it's in via the dots menu: edit controls are
hidden entirely outside tier 1, and a note explains why ("Read-only — run
node server.js here to edit", or "Read-only snapshot from <time>" for
tier 3).
Saving (persist() in index.html → server.js)
Every edit (add, edit, delete, bulk actions) goes through the same path:
- The page
POSTs the full{meta, bookmarks}object to/api/bookmarks. server.jsvalidates it, backs up whatever was inbookmarks.jsonbefore overwriting it (bookmarks.json.bak), then writes the new content atomically (write to a temp file, then rename).server.jsthen re-runsembed.js, so thefile://fallback snapshot inindex.htmlstays in step with what was just saved. A failure at this step is only logged — it never blocks the actual save, since the real data (bookmarks.json) is already safely written by that point.
There is no localStorage involved anywhere in this flow (an earlier
version cached edits there; that's been removed — bookmarks.json is the
only place data lives).
Known limitations
- No concurrency control. This is built for single-user, one-tab-at-a- time use. If two tabs/devices save at the same time, the last one to save wins and silently overwrites the other's changes.
- The
file://snapshot can go stale. Ifbookmarks.jsonis edited by hand (outside the app) without a subsequent save throughserver.js, the baked-in snapshot won't reflect that change until the next save, or untilnode embed.jsis run by hand.
Change history (high level)
- Original page —
index.html+bookmarks.json, read-only, loaded viafetch(), with a small hardcoded demo set as a fallback for when the fetch failed. - Edits via the UI were added at some point, but persisted only to the
browser's
localStorage— meaningbookmarks.jsonon disk was never actually updated, and different browsers/devices saw different data. - Phase 2 — removed
localStorageentirely; addedserver.js, a dependency-free local Node server with a save endpoint, so edits write straight back tobookmarks.json. This is the only way to edit. - Phase 3 — added
embed.jsand theEMBEDDED_SNAPSHOTtier, so that openingindex.htmldirectly (file://) shows real data instead of the old 4-item demo set, in every browser — not just Firefox.