Extract the public catalog contract into a shared package #7

Closed
opened 2026-07-17 19:09:54 +00:00 by yuris · 0 comments
Owner

Goal

Make the management API and storefront consume one versioned, runtime-validated catalog contract.

Scope

  • Create packages/catalog as @garage/catalog.
  • Move the public catalog schemas, product types, and response parser into the package.
  • Preserve the store parser's current strict validation, including exact fields, schema version, timestamps, slugs, product types, image values, and duplicate-slug rejection.
  • Make management use the shared schema when producing the public catalog response.
  • Make store use the shared parser at the HTTP trust boundary.
  • Add the package through workspace:* dependencies.
  • Move or consolidate catalog contract tests around the shared package while retaining app-specific fetch/API tests.

Acceptance criteria

  • No duplicate catalog response or product type definitions remain in either app.
  • Invalid or incompatible catalog responses are rejected by the store.
  • Management output validates against the same contract consumed by store.
  • A change to packages/catalog marks both applications as affected in Turborepo.
  • Existing catalog behavior and schema version 1 remain compatible.

Non-goals

  • Sharing database models or internal inventory fields.
  • A generic types or utils package.
  • Shared UI components.
## Goal Make the management API and storefront consume one versioned, runtime-validated catalog contract. ## Scope - Create `packages/catalog` as `@garage/catalog`. - Move the public catalog schemas, product types, and response parser into the package. - Preserve the store parser's current strict validation, including exact fields, schema version, timestamps, slugs, product types, image values, and duplicate-slug rejection. - Make management use the shared schema when producing the public catalog response. - Make store use the shared parser at the HTTP trust boundary. - Add the package through `workspace:*` dependencies. - Move or consolidate catalog contract tests around the shared package while retaining app-specific fetch/API tests. ## Acceptance criteria - No duplicate catalog response or product type definitions remain in either app. - Invalid or incompatible catalog responses are rejected by the store. - Management output validates against the same contract consumed by store. - A change to `packages/catalog` marks both applications as affected in Turborepo. - Existing catalog behavior and schema version 1 remain compatible. ## Non-goals - Sharing database models or internal inventory fields. - A generic `types` or `utils` package. - Shared UI components.
yuris closed this issue 2026-07-17 20:25:35 +00:00
Sign in to join this conversation.
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#7
No description provided.