[P1] Add internal-key catalog endpoint for static builds #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Expose a small, public-safe, read-only catalog endpoint that
garage-storecalls during its build to generate static product and service pages. The public site must not connect directly to PostgreSQL.Endpoint
GET /api/public/catalog(or the equivalent existing API route convention).Authentication
Protect the endpoint with a dedicated internal API key.
garage-storereceives the same key as a Vercel build-time secret.x-api-key.401or403.Response requirements
slugand fields from issue #2: public name, description, images list, publish state as needed, and existingtypeonly if useful.schemaVersionandgeneratedAt.Operations
Acceptance criteria
garage-storebuild fetches the endpoint with the internal key and generates static pages.Depends on issue #2. This replaces the earlier export-command concept.
PRD: https://git.nokopia.com/yuris/garage/src/branch/main/docs/store-prd.md
[P1] Generate validated garage-store catalog exportto [P1] Add read-only public catalog endpoint for static builds[P1] Add read-only public catalog endpoint for static buildsto [P1] Add internal-key catalog endpoint for static buildsImplemented in the local working tree. Added
GET /api/public/catalog, protected by server-onlyCATALOG_API_KEYviax-api-keywith SHA-256 digest + constant-time comparison. The query selects only published public fields, orders by slug, and returnsschemaVersion,generatedAt, and safe items. Added.env.exampleand Docker wiring for the shared Garage/garage-store build secret.Verification: missing and invalid keys returned 401; a valid key returned 200; seeded published/unpublished smoke records returned only the published safe projection; smoke records were removed.
pnpm test— 28 passed;pnpm build— passed.Leaving open until the working-tree changes are committed/pushed.