Files
proof-of-work/start9/0.4
Keysat 3f22ef7600
CI / proof-of-work (Next.js app) (push) Has been cancelled
CI / start9/0.4 (StartOS package code) (push) Has been cancelled
v1.1.0:9 — P2 hardening: input-validation 400s, auth rate-limit, XFF anti-spoof, non-root container
P2 batch from the 2026-06-13 full-eval (EVALUATION.md / ROADMAP.md), reviewed by the reviewer agent. App-code + packaging only; no schema or data change, existing /data untouched.

Input validation: malformed JSON bodies, invalid date, and out-of-range or non-numeric pagination on /api/workouts now return 400 instead of 500. New lib/http.ts readJsonBody maps a bad body to a ZodError across the 11 CRUD routes whose catch maps ZodError to 400; me/import and admin/signups guard request.json() in an explicit try/catch.

Rate limiting: POST /api/auth now shares the UI login server action's per-IP 10-per-15min cap and returns 429 + Retry-After. clientIpFromHeaders reads the rightmost (trusted-proxy-appended) X-Forwarded-For entry instead of the spoofable leftmost.

Container: drops root. The entrypoint prepares /data as root, chowns it to nextjs, then exec su-exec nextjs:nodejs node server.js (su-exec added to the runner image). The container drop needs live sideload verification.
2026-06-13 00:03:47 -05:00
..
2026-05-09 13:40:58 -05:00

Proof of Work Logo

Proof of Work on StartOS 0.4 (migration package)

This directory packages Proof of Work (proof-of-work) for StartOS 0.4 beta. It is the cutover package that carries your 0.3.5 data across to a new x86_64 StartOS 0.4 host.

Upstream app lives at ../../proof-of-work/ in this repo. Legacy 0.3.5 package lives at ../0.3.5/ (kept intact; do not modify). Codex's WIP 0.4 scaffold lives at ../0.4/ (kept intact; superseded by this folder).

Goals

  • Keep the package id proof-of-work so StartOS recognizes it as the same service.
  • Keep the persistent data volume main mounted at /data.
  • Keep the SQLite database at /data/app.db.
  • Preserve every existing workout, set, exercise, and preference.
  • Ship x86_64 only for 0.4 beta (sideload target).

How data preservation works

  1. seed/data/app.db holds a one-time snapshot of /data from the live 0.3.5 host (currently 1 user, 348 workouts, 164 exercises, 5720 set logs).
  2. The Dockerfile bakes that snapshot into the image at /app/seed/data/.
  3. On first boot only/data/app.db missing AND /data/.seeded absent — docker_entrypoint.sh copies the seed into /data/ and writes a .seeded marker.
  4. On every subsequent boot, /data/ is the sole source of truth; the seed in the image is ignored.

See seed/README.md for the snapshot provenance and row counts.

Image runtime

Property Value
Base image node:20-alpine (multi-stage build)
App runtime Next.js standalone + Prisma + SQLite
Entrypoint /usr/local/bin/docker_entrypoint.sh (dumb-init wrapped)
Internal port 3000
Architectures x86_64 (beta)

Build and sideload

cd start9/0.4
npm ci
make clean
make x86      # outputs proof-of-work_x86_64.s9pk

Sideload via StartOS web UI or make install (requires ~/.startos/config.yaml). Step-by-step instructions are in DEPLOY_040.md.

What is unchanged from 0.3.5

  • Package id: proof-of-work
  • Volume id: main
  • Mount path: /data
  • DB path: /data/app.db
  • Health endpoint: /api/health
  • Compat ALTER TABLE block (idempotent; no-op on a current DB)

What is new in 0.4

  • TypeScript SDK manifest under startos/
  • ExVer version (0.1.0:18) replaces the 0.3.5 4-part 0.1.0.17
  • Seed-on-first-boot with a .seeded marker and stderr logging
  • alertUpdate warning users not to Uninstall to troubleshoot
  • Self-contained Dockerfile — no references to ../0.3.5/ or ../0.4/

Follow-up releases (planned, do not ship yet)

  • v0.1.0:19 — remove the COPY seed/data \u2026 line and the seed block from the entrypoint once the cutover is confirmed. Leaves seed/ on disk unreferenced.
  • v0.1.0:19 or v0.1.0:20 — add a StartOS Package Action change-admin-credentials that updates the User row in /data/app.db (bcryptjs, salt rounds 10) so you can rename/rotate the admin from the StartOS UI.