From 747e49f46a8323c5da3960e66395b72258e178fe Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 9 Oct 2026 19:19:21 +0000 Subject: [PATCH] Spec: drop import, lock base currency, env-configurable domain and limits Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF --- SPEC.md | 58 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/SPEC.md b/SPEC.md index a331aad..2130f2f 100644 --- a/SPEC.md +++ b/SPEC.md @@ -3,7 +3,7 @@ A mobile-first, end-to-end encrypted group expense splitter (a Settle Up clone) that runs in any browser, on phones and desktops alike. -Status: **draft v1** · Last updated: 2026-10-09 +Status: **v1, agreed** · Last updated: 2026-10-09 --- @@ -30,6 +30,7 @@ Status: **draft v1** · Last updated: 2026-10-09 log makes every change reversible). - Native mobile apps. - Real payments / bank integration. +- Importing from other apps (Settle Up, Splitwise, …). --- @@ -259,10 +260,13 @@ the minimum in practice, and is easy to reason about. - Create group: name, base currency (default by locale: CZK for Czech, EUR otherwise), icon/emoji, initial members. - Share: copy link, native share sheet, QR code. -- Settings: rename, base currency (change converts nothing retroactively — - existing expenses keep their rates; balances are re-expressed via a stored - rate for the switch, shown to the user before confirming), members, "who am - I", remove from device, export, delete group (see 8.3). +- Settings: rename, members, "who am I", remove from device, export, delete + group (see 8.3). +- **Base currency is locked once the group has any expense or transfer.** It + can be changed freely while the group is empty; afterwards the setting is + read-only with a short explanation. Clients enforce this during replay too: + a `group.updated` that changes `baseCurrency` after the first expense event + is ignored. ### 7.2 Expenses @@ -302,14 +306,12 @@ Client-side charts per group, filterable by date range: - Per member: paid vs. consumed. - "My spending" view. -### 7.6 Export / backup / import +### 7.6 Export / backup - **CSV export** of expenses (one row per expense, columns per member share) and of current balances. - **Encrypted backup**: full event log + photos as one file, encrypted with - the group key. Import restores to the same or a new server. -- **Import from Settle Up**, and from Splitwise as a bonus, from their CSV/Excel - exports. *Needs a sample export file to pin down the format.* + the group key. Restoring it recreates the group on the same or a new server. ### 7.7 Push notifications @@ -359,8 +361,10 @@ All group endpoints require `Authorization: Bearer `. - SQLite (WAL) for groups, events, push subscriptions, rates. - Blobs on disk: `data/blobs//`. -- Limits (configurable via env): photo blob ≤ 2 MB, event ≤ 64 KB, - per-group storage ≤ 200 MB, group creation rate limit. +- Limits (env variables, see 13): photo blob ≤ 2 MB (`MAX_PHOTO_BYTES`), + event ≤ 64 KB (`MAX_EVENT_BYTES`), per-group storage ≤ 200 MB + (`MAX_GROUP_BYTES`), group creation rate limit (`GROUP_CREATE_PER_HOUR`). + The thumbnail counts as part of its photo. - Inactive-group retention: none by default (configurable). --- @@ -493,8 +497,11 @@ Deploy steps (documented in `deploy/README.md`): 1. Point a DNS A/AAAA record at the VPS. 2. `cp deploy/.env.example deploy/.env && chmod 600 deploy/.env`, then set - `DOMAIN`. Generate VAPID keys with the provided script, which writes them - into `.env` without printing them. + `DOMAIN` (e.g. `oweme.example.com`). `compose.yaml` passes it to both + services as `${DOMAIN}`: Caddy uses it for the site address and + certificate, and the app uses it for share links and the CSP. Generate + VAPID keys with the provided script, which writes them into `.env` without + printing them. 3. Rootless Podman cannot bind ports < 1024 by default: either set `net.ipv4.ip_unprivileged_port_start=80` via sysctl, or publish 8080/8443 and redirect with the firewall — both documented. @@ -502,6 +509,18 @@ Deploy steps (documented in `deploy/README.md`): 5. Backups: copy the data volume. All contents are already encrypted, so backups can be stored anywhere. +Environment variables (`deploy/.env`, read by `compose.yaml`): + +| Variable | Required | Default | Purpose | +|---|---|---|---| +| `DOMAIN` | yes | — | Public hostname; Caddy site + TLS, share links | +| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | yes | — | Web Push (generated by script) | +| `VAPID_SUBJECT` | yes | — | `mailto:` contact for push services | +| `MAX_PHOTO_BYTES` | no | `2097152` | Per-photo upload cap | +| `MAX_EVENT_BYTES` | no | `65536` | Per-event cap | +| `MAX_GROUP_BYTES` | no | `209715200` | Per-group storage cap | +| `GROUP_CREATE_PER_HOUR` | no | `10` | Group creations per IP per hour | + Development (on the dev box): servers bind `127.0.0.1` only; preview over an SSH tunnel. Ports and commands go in `AGENTS.md`. @@ -517,15 +536,4 @@ SSH tunnel. Ports and commands go in `AGENTS.md`. 3. **History**: activity feed, per-expense history, restore, group rewind. 4. **Extras**: comments, categories, statistics, recurring expenses, CSV export, encrypted backup/restore. -5. **Notifications & import**: Web Push, Settle Up / Splitwise import. - ---- - -## 15. Open questions - -- **Settle Up import:** need a sample export file to define the mapping. -- **Domain name** for the VPS deployment. -- **Storage limits:** are 2 MB per photo and 200 MB per group right? -- **Base currency change:** convert existing balances via a rate at switch - time (current proposal), or forbid changing the base currency once - expenses exist? +5. **Notifications**: Web Push.