- boundary: src/ui/ErrorBoundary.tsx, around the whole app rather than around a screen. A throw on the way to the first paint used to be a white page with nothing in it to report; it is a sentence, the message and the stack now, with a reload beside them, so the next report of a crash carries what went wrong. - one window: src/ui/SingleTab.tsx holds the app to one tab over localStorage and a BroadcastChannel. A second tab on /app or /library is told so and offered the roll — "use this tab" takes it, and the tab that held it gets a bar and the offer back. A tab holding a reading is a tab the machine has already spent its memory on, and a second one beside it is the memory the first will not get. - mount: the studio and the library are mounted the first time their route is asked for and stay mounted after that, not on every visit. Booting CanvasKit (~20MB) and reading the whole catalogue on a page that shows neither is the read and the memory a machine short of either takes for a crash; a trip back from the studio is a screen opening rather than a page loading. - reading: READ_MS bounds one touch of the disk at 30s. getFile and arrayBuffer on a drive that has gone away do not fail, they never settle — the lane waits for ever, the reading never ends, and STOP is a button with nothing left to read it. A frame given up on is a frame the next reading takes up again. - reading: the rows of a walk go down a pass at a time, so a tab that never comes back leaves the column with the folders this reading walked rather than the ones the last reading did. - reading: a stopped reading hands over the numbers it counted instead of null. Handed null it threw its own count away and had noughts written for every folder it walked that the file did not already hold, so a folder added to a drive read nought until the next scan. - repair: STOP ends the afternoon. A repair is a loop the button has no handle on, so it holds the count of stops it started at and compares between rolls, and says it was cut short rather than reporting a run it did not make. - add: a folder the browser could not name — every drive root on Windows is "\" — is asked for one, and a folder whose name is already another folder's is refused rather than folded in with it. The record, the frame ids, the walk's position and the number the column draws are all keyed by that name. - wall: four hundred tiles queued ahead is a reader waiting on frames three screens below the one they are looking at; sixty is a screenful and the wall mints the rest as it scrolls. The catalogue is read back every 30s, not every 5s — reading it back costs every thumbnail in it. - library: the note is drawn under the frame rather than above it. A line that comes and goes in the flow moved the frame, the column and the strip by its own height every time a scan started or ended. - manifest: "id": "/", so the installed app and the tab are one app. - checks: tree-scan-check waited for a count of exactly four rows — a state the screen does not have. The wait ran out its clock and then measured whatever the reading had done since; it waits for the whole tree now.
RecipesCam web — self-contained stack
A Docker-hosted web build of RecipesCam. Everything it needs is in this folder: move it to another machine, run two commands, and the app is up. It does not need the React Native project around it.
cp .env.example .env
docker compose up -d --build
# → http://localhost:8090
What runs where
| Service | Image | Role |
|---|---|---|
frontend |
nginx:1.27-alpine (built by frontend/Dockerfile) |
Static SPA + /api/ reverse proxy |
api |
node:22-slim (built by backend/Dockerfile) |
Accounts + saved recipes, SQLite on ./data |
frontend resolves api through Docker's embedded DNS and proxies /api/* to
it — that is why the API container is named api and why it is not published on
the host. Only ${WEB_PORT:-8090} is exposed.
Photos never leave the browser. The CanvasKit render pipeline (grade, frame, watermarks, JPEG encode) runs in the visitor's tab; the API only stores recipes as JSON.
Layout
docker-compose.yml the stack
.env.example WEB_PORT
data/ SQLite (created on first run, gitignored)
backend/ Fastify + better-sqlite3 API, own Dockerfile
frontend/ Vite + React + CanvasKit SPA, own Dockerfile + nginx.conf
shared/ vendored copies of the app's types + utils (see below)
src/engine/ skiaShim.ts (CanvasKit) + exportEngine.ts (render pipeline)
+ session.ts (localStorage/IndexedDB studio persistence)
Vendored files
frontend/shared/{types/index.ts,utils/*.ts} are byte-identical copies of
src/types/index.ts and ten src/utils/*.ts files from the React Native
project (@shopify/react-native-skia is aliased to src/engine/skiaShim.ts in
vite.config.ts + tsconfig.json, so those files compile unchanged):
cinemaShader colorUtils defaultRecipes exifWrite frameUtils jpegDpi
paramDefs recipeShare skiaImage toneShader.
The landing page needs no CDN: frontend/public/assets/fonts/*.woff2 are the
seven self-hosted faces behind the three font groups the Themes menu offers
(Plus Jakarta Sans / Inter / JetBrains Mono, Fraunces / Be Vietnam Pro /
Courier Prime, Be Vietnam Pro / Space Mono — all SIL OFL, pulled from Google
Fonts, vietnamese + latin + latin-ext subsets), and
frontend/public/assets/samples/s*.jpg are the six placeholder negatives the
film strip, preset tester and QR card show (swap them for real graded stills
whenever we have them). Its one foreign request is the QR image from
api.qrserver.com, which degrades to an empty slot offline.
When the app changes one of them, copy it back in — the renderer is only "parity" for as long as these stay in sync:
cd <repo>/docker/frontend/shared/utils
cp <repo>/src/utils/<name>.ts .
Operations
docker compose logs -f api # API log
docker compose restart api # after backend/src changes (rebuild: --build)
docker compose down # stop; ./data survives
Backup is the ./data folder — that is the whole database.
Checks
curl -s http://localhost:8090/api/health # {"ok":true}
curl -sI http://localhost:8090/ # 200, index.html
Then open the UI, drop a photo in, and confirm the preview shows the picture and
EXPORT downloads a JPEG that opens. The preview going solid black while the
export still reports a plausible size is the one failure mode worth knowing: it
means the CanvasKit GPU surfaces lost their shared GrDirectContext (see
frontend/src/engine/skiaShim.ts), and with no GPU the raster fallback renders
the same pipeline correctly, just slower.