# Blueprint: `commerce-storefront` (single-seller store)

> Audience: AI coding agents first. A blueprint is a **worked example** in `apps/consumer`, not a shipped product.

## Preset
```
registry.json → presets.commerce = util · db · billing · tax · ledger · uploads · search
```
Plus blueprint-local deps: auth · mail · jobs · seo · commerce-catalog · commerce-cart · commerce-checkout · commerce-orders · commerce-inventory · commerce-fulfillment · commerce-promotions · commerce-reviews

## Four artifacts
1. `recipe.md` — this file
2. `wiring/<module>.ts` — one per module, one factory function each
3. `apps/consumer/tests/blueprint-commerce-storefront.test.ts` — composition proof
4. `apps/consumer/package.json` — devDependencies

## Wiring seams
Each wiring file exports one `create*` factory. Read the file for its contract.

- `wiring/catalog.ts` — createStorefrontCatalog(db)
- `wiring/cart.ts` — createStorefrontCart() (in-memory for tests, real: commerce-cart/store-db)
- `wiring/checkout.ts` — createStorefrontCheckout(db, billing, fulfillmentPorts)
- `wiring/orders.ts` — createStorefrontOrders(db)
- `wiring/fulfillment.ts` — createFakeFulfillmentPorts() (inline fakes for StorageAdapter + CarrierAdapter)
- `wiring/inventory.ts` — createStorefrontInventory(db)
- `wiring/promotions.ts` — createStorefrontPromotions(db)
- `wiring/reviews.ts` — createStorefrontReviews(db)
- `wiring/auth.ts` — createStorefrontAuth(db) with roles: guest/customer/merchant/owner
- `wiring/search.ts` — REUSE createProductIndex from ../commerce/wiring/search (import and re-export)
- `wiring/mail.ts` — createStorefrontMailer() (capture adapter for tests)
- `wiring/seo.ts` — createSeoHelpers({ baseUrl, siteName })

## Blueprint-owned vs host-owned
Blueprint-owned: the wiring contracts in this directory.
Host-owned: routes, pages, UI, schemas, entity definitions, theme.

## Marketplace containment
The marketplace blueprint IMPORTS these wiring files unchanged. Do not add seller/vendor/split logic here.
