Shelfie Runbook

Operational notes for Edward (and future contributors).

Environments

Backups

Postgres (Supabase)

R2 (photos)

Code

Restore drills (monthly)

  1. Spin up a throwaway Supabase project in the same region.
  2. pg_restore --clean --no-owner --dbname=$RESTORE_URL latest.dump
  3. Run npm run dev against the restored URL. Verify a known book renders.
  4. Time how long the drill took. If over 30 minutes, revisit the snapshot strategy.
  5. Tear down the throwaway project.

Soft-delete

Secrets rotation

On-call basics

Publish CLI / MCP packages

One-time setup on Edward's machine:

npm login                              # opens browser, authenticates
npm whoami                             # confirms

Then from the repo root:

npm run publish:mcp                    # publishes shelfie-mcp@<current>
npm run publish:cli                    # publishes shelfie-cli@<current>
# or both:
npm run publish:packages

Bump mcp/package.json and cli/package.json versions before re-publishing -- npm rejects the same version twice.

Cron jobs

Vercel cron (configured in vercel.json):

Both require CRON_SECRET to authorize requests. Set it in Vercel project env (Production + Preview).

Embeddings backfill

If new books pile up unembedded, kick the cron manually:

$env:CRON_SECRET="..."
curl -H "Authorization: Bearer $env:CRON_SECRET" https://shelfiebook.com/api/cron/embeddings

The cron will keep chewing 1024 books per run until caught up.