Add idempotent local demo catalog seed #14

Merged
yuris merged 1 commit from issue-13-demo-seed into main 2026-07-17 21:15:07 +00:00
Owner

Closes #13. Unblocks the store static-build verification in #9.

Problem

pnpm --filter garage-store build (output: "export") fails when the catalog has zero published items:

Page "/products/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.

Next.js 16.2.10 is current — no upgrade available or needed. generateStaticParams() is present; the exporter simply needs at least one published product to prerender. This is a data prerequisite, not a code defect.

Change

  • apps/management/scripts/seed-demo.mts: local-only script that upserts published demo inventory items by slug.
  • apps/management/package.json: db:seed:demo script.

Design:

  • Idempotent — upsert on the inventory_slug_uniq index; re-runs don't duplicate.
  • Guards against a non-local DATABASE_URL (substring check); override with SEED_DEMO_ALLOW_REMOTE=1.
  • Not wired into migrations or production startup — schema and demo data stay separate.

Usage

devenv up
pnpm --filter garage db:seed:demo
pnpm --filter garage-store build

Verification

  • Seed run twice → 2 published rows, no duplicates.
  • Remote-URL guard rejects a non-local DATABASE_URL (exit 1) unless overridden.
  • pnpm --filter garage-store build succeeds; generates apps/store/out/index.html and apps/store/out/products/{oli-mesin-10w-40,filter-oli-universal}.html; /products/[slug] prerendered as SSG.
  • biome check clean.

Scope note

Closes #13 (build unblocked + repeatable local verification). Does NOT close #9: production secrets/env verification, image deploy, real catalog data, canonical links, legacy notice, and archiving garage-store remain. Demo products are for local testing only — do not deploy them to production.

Closes #13. Unblocks the store static-build verification in #9. ## Problem `pnpm --filter garage-store build` (`output: "export"`) fails when the catalog has zero published items: ``` Page "/products/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config. ``` Next.js 16.2.10 is current — no upgrade available or needed. `generateStaticParams()` is present; the exporter simply needs at least one published product to prerender. This is a data prerequisite, not a code defect. ## Change - `apps/management/scripts/seed-demo.mts`: local-only script that upserts published demo inventory items by slug. - `apps/management/package.json`: `db:seed:demo` script. Design: - Idempotent — upsert on the `inventory_slug_uniq` index; re-runs don't duplicate. - Guards against a non-local `DATABASE_URL` (substring check); override with `SEED_DEMO_ALLOW_REMOTE=1`. - Not wired into migrations or production startup — schema and demo data stay separate. ## Usage ```bash devenv up pnpm --filter garage db:seed:demo pnpm --filter garage-store build ``` ## Verification - Seed run twice → 2 published rows, no duplicates. - Remote-URL guard rejects a non-local `DATABASE_URL` (exit 1) unless overridden. - `pnpm --filter garage-store build` succeeds; generates `apps/store/out/index.html` and `apps/store/out/products/{oli-mesin-10w-40,filter-oli-universal}.html`; `/products/[slug]` prerendered as SSG. - `biome check` clean. ## Scope note Closes #13 (build unblocked + repeatable local verification). Does NOT close #9: production secrets/env verification, image deploy, real catalog data, canonical links, legacy notice, and archiving garage-store remain. Demo products are for local testing only — do not deploy them to production.
Local-only script that upserts published inventory items by slug so the
store static export (output: export) has at least one product to
prerender. Guards against non-local DATABASE_URL; not wired into
migrations or production startup.

Closes #13
yuris changed title from Add idempotent local demo catalog seed (#13) to Add idempotent local demo catalog seed 2026-07-17 21:14:37 +00:00
yuris merged commit a8f14cb791 into main 2026-07-17 21:15:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!14
No description provided.