Deploy is now `podman compose up -d` from the root. Add .containerignore so node_modules, local data and .env stay out of the build context, and mount only .env (not the whole tree) when generating VAPID keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
2.9 KiB
2.9 KiB
AGENTS.md — OweMe
End-to-end encrypted group expense splitter (a Settle Up clone). Read
SPEC.md first; it is the source of truth for behaviour and is kept current.
Layout
packages/core/— pure TypeScript shared by client and service worker: event schema, validation, money math, replay/rewind, settle-up, recurring, stats, CSV. No I/O, no floats for money.apps/server/— Node 24, standard library only (node:http,node:sqlite,node:crypto), run directly as TypeScript (type stripping: erasable syntax only,.tsimport extensions). No npm dependencies; keep it that way unless there's a strong reason.apps/web/— Svelte 5 SPA + service worker (src/sw.ts, built separately byvite.sw.config.tsas a classic script).compose.yaml+.env.example(repo root) — the podman compose deployment.deploy/— Containerfile, Caddyfile, deploy docs.e2e/— Playwright tests against the production build.
Run
Node lives at ~/.local/node/bin on the dev box (not on PATH by default).
npm ci
npm run dev # API 127.0.0.1:8481 + Vite 127.0.0.1:8480
Preview from your machine: ssh -p 14922 -L 8480:localhost:8480 <dev box>,
then http://localhost:8480.
Test
npm test # core (vitest) + server (node:test)
npm run check # tsc + svelte-check (must be 0 errors, 0 warnings)
npm run build && npm run test:e2e
E2E uses the Playwright browsers cached in ~/.cache/ms-playwright
(@playwright/test is pinned to 1.63.0 to match them). e2e/push.spec.ts
needs full Chromium (channel: 'chromium'): the headless shell denies
notifications.
Invariants — do not break
- The server never sees plaintext or keys. The group secret exists only
in the URL fragment, IndexedDB and backup files. Never send it in a path,
query string, header or log line. The server stores
SHA-256(authToken). - Every client computes identical balances. Money is integer minor units;
rates are decimal strings; rounding is largest-remainder with ties to
member order, conversion is round-half-even (BigInt). Any change to money
math needs a test in
packages/core/test/. - The event log is append-only. Undo is a new event (
revert,expense.restored, …), never a deletion. Replay must ignore invalid events (validateExpense), not crash. - New event types go in
types.ts(EventBody),replay.ts(with validation), the activity text inActivity.svelteand both locale files. - i18n: every string in
locales/en.tsandlocales/cs.ts(the type enforces it). English is the default; Czech only if the browser prefers it. - Push endpoints are restricted to the allowlist in
push.ts(no SSRF). Push payloads carry only the group id. - Strict CSP: no inline scripts, no third-party origins.
- Containers: rootless Podman; for local testing publish to
127.0.0.1only (BIND_ADDR=127.0.0.1in.env).