diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..c97adeb --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,73 @@ +# Moon Base — Project Notes + +Property management for the Moon homestead (Eau Claire, WI) — food forest plant +registry, home maintenance tracking, and equipment logs. Next.js 14 + Prisma + +Postgres. Same conventions as FMB (`/Users/bonnamoon/Projects/fullmoonbakehouse`). + +## Modules + +- **v0.1 — Garden:** food forest plant registry + care/harvest log. Live. +- **Home maintenance** — planned next: systems, recurring tasks, repair history. +- **Equipment** — planned: tools/machines, service intervals, maintenance logs. + +## Local dev + +- DB: `postgresql://tonym@localhost:5432/moonbase_dev` +- Copy `.env.example` → `.env` and fill in values. +- `npm install` then `npm run dev` (port 3000) +- After schema edits: `npx prisma generate` then restart dev server. +- Seed demo data: `npm run db:seed` (creates Bonna + Tony accounts + sample plants) +- Minimal seed (admin accounts only): `SEED_MODE=minimal npm run db:seed` +- Apply migrations: `npx prisma migrate deploy` + +## First-run setup (brand new machine / fresh DB) + +1. `npm install` +2. Create `.env` from `.env.example` +3. `npx prisma migrate deploy` — creates the DB schema + provisions Bonna and Tony accounts +4. Default password for both is `moonbase!` with `mustChangePassword=true` — change on first login. + +## Conventions (same as FMB) + +- **Every commit bumps APP_VERSION** in `src/lib/version.ts` + a plain-English + entry at the top of `src/lib/changelog.ts`. Minor (0.X.0) for features/migrations, + patch for fixes. Write changelog for Bonna, not engineers. +- **AuditEvent on every mutation** — append-only, never delete. +- **Soft-delete** via `active=false` for Plant (keeps log history intact). +- **Pure core + colocated test** — new logic goes in `src/lib/...` as a pure + function with a `.test.ts` next to it; API routes stay thin. +- **Worktrees for parallel sessions** — same pattern as FMB. Use a worktree + (`git worktree add ../moonbase- -b `) if running two Claude sessions. + +## Git remote + +Add Gitea remote once the repo is created there: +```sh +git remote add gitea http://192.168.0.5:3022/tonym/moonbase.git +git push gitea main +``` + +## Auth + +- Username OR email login (same as FMB). Accounts: `bonna` / `tony`, role ADMIN. +- `mustChangePassword=true` on provisioned accounts — user is prompted on next login + (add that redirect to `src/app/(dashboard)/layout.tsx` when implementing it). +- `getSession()` / `isAdmin()` in `src/lib/auth.ts`. + +## Garden module — data model + +- **Plant** — commonName, species (scientific), variety, category (PlantCategory enum), + zone (freeform text: "Back yard north fence"), plantedAt, source, notes, active. +- **PlantLog** — per-plant log: type (OBSERVATION / CARE / HARVEST / TREATMENT / + TRANSPLANT / DIED), date, notes, quantity (freeform, for harvests). +- Category labels + log type labels/colors live in `src/lib/garden/categories.ts`. +- API: `POST /api/plants` (create plant), `POST /api/plants/[id]/logs` (add log entry). + +## Color palette + +Forest / earth theme. Key CSS variables: +- `--canopy` — dark forest green sidebar +- `--leaf` — fresh green accent +- `--soil` / `--soil-muted` — body text +- `--dew` — pale sage background +- `--ember` — red for destructive actions