Document codebase: comments, per-area READMEs, deployment guide

Readability pass across all four areas of the stack. Comments explain why
rather than what, concentrated at the points where behaviour is non-obvious:
concurrency, caching, auth, scraping and nginx templating.

Backend: doc comments on every exported declaration across handlers,
services, models and resolvers. Resolver commentary lives inside function
bodies so gqlgen does not strip it on regeneration; schema files use #
comments rather than description blocks so introspection output is
unchanged. Extracted the duplicated auth-cookie blocks into helpers.

Frontend: header comments on every component, store and view, including
STATUS: notes marking which of the parallel/legacy views are still live.
Documented the non-reactive animation-state pattern, the homeData hub and
the WebSocket stale-socket guard. Removed a few dead imports and named the
reconnect-backoff and poll-interval constants.

Python: module and function docstrings covering the Travelodge scraping
contract, the deadline threading, the two-executor concurrency and the
NDJSON streaming protocol.

Infra: header blocks on every compose file, nginx template, Dockerfile and
entrypoint, covering the config selection, envsubst allow-lists, rate-limit
semantics and volume persistence. Hoisted the duplicated envsubst variable
list in nginx/entrypoint.sh.

New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example,
backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which
stated a 24h access token where main.go sets 7 days.

No behaviour change. go build/vet, vite build, py_compile and docker
compose config all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-09-16 15:57:48 +01:00
co-authored by Claude Opus 5
parent a1102b4aa1
commit 64df70e5d2
183 changed files with 4691 additions and 204 deletions
+24
View File
@@ -1,3 +1,27 @@
# =============================================================================
# Quartz image — builds the Obsidian notes site.
#
# HOW THE SOURCE IS OBTAINED: Quartz is not an npm package you depend on, it is
# an application you clone and configure. So the image `git clone`s the
# upstream repo at build time, which is why `git` is installed. --depth 1
# --branch pins to an exact tag (QUARTZ_VERSION, overridable as a build ARG)
# and fetches no history — a shallow clone is much faster on a Pi and the
# history is of no use here.
#
# Because this clone happens at build time, upstream Quartz is only updated
# when the image is rebuilt with a bumped QUARTZ_VERSION. The tag pin is the
# thing stopping an upstream change from breaking the notes site on a routine
# redeploy.
#
# gettext-base supplies `envsubst` for rendering quartz.config.ts from its
# template at container start (see quartz/entrypoint.sh).
#
# quartz.config.ts.template and quartz.layout.ts are copied in AFTER the clone
# so they land on top of the upstream defaults — layout is used as-is, config
# is templated at runtime because it needs DOMAIN.
#
# node:22-slim is multi-arch, so this builds unchanged on the Pi.
# =============================================================================
FROM node:22-slim
RUN apt-get update \
+34
View File
@@ -1,4 +1,38 @@
#!/bin/sh
# =============================================================================
# quartz entrypoint — render the config, then build-and-serve the notes site.
#
# WHAT IT DOES
# Quartz turns the Obsidian vault into a static site. Its config is a
# TypeScript file that has to know the public base URL, which is only known
# at runtime, so quartz.config.ts is generated from a template on each start.
#
# THE envsubst ALLOW-LIST
# Only ${DOMAIN} is substituted. This matters more here than elsewhere: the
# template is TypeScript and full of `${...}` -shaped syntax and dollar signs
# that must NOT be touched. Restricting envsubst to a single name guarantees
# it can only ever rewrite the one intended line (baseUrl).
#
# WHY build --serve RATHER THAN A STATIC BUILD
# --serve leaves Quartz running as an HTTP server AND watching the content
# directory, so editing a note in Obsidian on the host re-renders the site
# live with no container restart. The vault is bind-mounted READ-ONLY
# (docker-compose.yml), so Quartz can watch it but never write to it.
# The trade-off is that this is a long-running Node process on a Pi rather
# than pre-built static files nginx could serve for free.
#
# ACCESS CONTROL
# None here — Quartz is wide open on its port inside app-network. The site is
# private because nginx gates /notes/ behind an `auth_request` admin check
# before proxying. Never publish this container's port to the host.
#
# ENV VARS
# DOMAIN required; becomes baseUrl "www.<DOMAIN>/notes"
# QUARTZ_PORT optional, defaults to 8080; must match the QUARTZ_PORT nginx
# builds its upstream from, or /notes/ 502s.
#
# `exec` so the Node process becomes PID 1 and receives docker's signals.
# =============================================================================
set -e
envsubst '${DOMAIN}' \
+23
View File
@@ -1,3 +1,26 @@
// =============================================================================
// quartz.config.ts.template — Quartz site config, rendered to quartz.config.ts
// by quartz/entrypoint.sh at container start.
//
// ONLY the DOMAIN placeholder is substituted (envsubst is given a one-name allow-list), so
// every other dollar sign and backtick-template-looking construct in this
// TypeScript file survives untouched. That restriction is deliberate: a bare
// envsubst over a .ts file would corrupt it.
//
// baseUrl must keep pointing at www.<DOMAIN>/notes — it has to match the path nginx
// proxies (/notes/) or every internal link, the sitemap and the RSS feed point
// at the wrong place.
//
// enableSPA / enablePopovers are off because this site is embedded under a
// path inside another SPA; Quartz's own client-side router would fight with it.
//
// ignorePatterns keeps "private", "templates" and ".obsidian" out of the build
// — the vault is mounted whole, so this list is the only thing stopping
// private notes being published. Check it before adding vault folders.
//
// This file is committed with real content (no secrets). quartz.layout.ts sits
// alongside it and is COPY'd in by quartz/Dockerfile without templating.
// =============================================================================
import { QuartzConfig } from "./quartz/cfg"
import * as Plugin from "./quartz/plugins"