Files
famapp/docs/tasks/07-household-seed.md
ginnoir b89690a9f2 Initial scaffold: tooling, plan, task briefs
- pnpm 10 workspace + TypeScript strict + ESLint flat + Prettier
- CLAUDE.md as canonical brief
- docs/tasks/ — 22 task briefs broken out by phase for sub-sessions
- docs/decisions/ — ADR scaffold

Implements task 01 (repo-init).
2026-05-06 00:05:50 -05:00

1.2 KiB

07 — Household seeding & session

Goal

On first boot, create the single household and attach Matt + wife to it. Every authenticated request resolves a householdId cheaply.

Depends on

  • 06 (auth)

Scope

  • Migration / seed script (pnpm db:seed) that inserts one household named "Home" if none exists.
  • On first OIDC login, attach the user to the seeded household as owner (Matt) or member (everyone else). Idempotent.
  • getCurrentSession() server helper returns { user, household, role }. Throws if no household membership.
  • All later modules' queries take householdId as the scope key.
  • /settings/household page showing household name, member list, and a "rename household" form (owner only).

Out of scope

  • Multi-household UI (schema supports it; UI is single-household only).
  • Invite flows (Authentik provisions accounts; we just attach them).

Acceptance criteria

  • pnpm db:seed is idempotent — running twice does not create duplicate households.
  • First user to sign in becomes owner; subsequent users become member.
  • getCurrentSession() returns a typed object with household.id.
  • /settings/household renders for both roles; rename only works for owner.