---
name: openfront-grocery-custom-storefront
description: Plan and build a custom Openfront Grocery storefront by explaining the source architecture, interviewing the user, inspecting the current product code and contract, then adapting the built-in client or creating a safe separate client.
---

# Openfront Grocery custom storefront

Use this skill to adapt the built-in Grocery storefront or create a separately deployed client. Start from this product's current source—not E-commerce conventions, screenshots, or another vertical's schema.

## Source orientation to explain first

Before asking implementation questions, briefly tell the user where the current behavior lives:

- Repository: <https://github.com/openshiporg/openfront-grocery>
- Built-in Grocery customer experience: `features/storefront` — `screens/` (one per page), `modules/` (account, contact, lists, market, notifications, order-access, order-adjustment, order-substitution, products, subscriptions, urban UI primitives), and `lib/data/` (GraphQL loaders and server actions for cart, checkout, payment, orders, guest orders, delivery, deals, departments, products, lists, subscriptions, addresses, store, user).
- Thin customer-facing route entry points: `app/(storefront)/**`. There is no country or region segment.
- Current routes: `/`, `/products`, `/products/[slug]`, `/departments`, `/departments/[handle]`, `/deals`, `/fulfillment`, `/cart`, `/checkout`, `/order/[id]`, `/order-access`, `/account`, `/account/sign-in`, `/account/register`, `/account/reset`, `/account/orders`, `/account/addresses`, `/account/profile`, `/account/privacy`, `/lists`, `/favorites`, `/subscriptions`, `/support`, `/policies`, `/staff/accept`.
- Server contract: `features/keystone/models/**`, `features/keystone/access.ts`, `features/keystone/lib/storeAccess.ts`, `features/keystone/mutations/**` (custom roots registered in `mutations/index.ts`), and `schema.graphql`.
- Provider boundaries: `features/integrations/payment` (Stripe `pp_stripe_default` is the only public checkout adapter; a local test adapter is refused in production), `features/integrations/communications` (SMTP), `features/integrations/events`, and the webhook route `app/api/payments/webhooks/[providerCode]`.

Explain that `features/storefront` is the behavioral reference for routes, states, GraphQL calls, cookies/tokens, and provider handoffs. It should guide what is preserved or changed.

Public reads are scoped to one Store through `PUBLIC_STORE_ID` (`store_juniper`). Carts and guest orders use HttpOnly cookies set by server actions; guest orders use a signed token.

Key storefront operations: `publicGroceryStorefrontSettings`, `publicGroceryProducts`, `publicGroceryProduct`, `publicGroceryCoupons`, `publicGroceryAvailability`, `groceryCart`, `addItemToGroceryCart`, `updateGroceryCartItem`, `removeItemFromGroceryCart`, `clearGroceryCart`, `mergeGuestGroceryCart`, `updateGrocerySubstitutionPreference`, `activeCartPaymentProviders`, `initiatePaymentSession`, `submitGroceryOrder`, `resumeGroceryCheckout`, `restartGroceryCheckout`, `guestGroceryOrder`, `requestGuestOrderAccess`, `customerOrderSubstitutions`, `respondToOrderLineSubstitution`, `authorizeOrderAdjustment`, `customerCheckIn`, `guestCustomerCheckIn`, `reorderGroceryOrder`, shopping-list commands (`createCustomerShoppingList`, `addToShoppingList`, `toggleShoppingListItemChecked`, `addShoppingListToCart`, and others), `saveFavoriteProduct`, `requestGroceryBackInStockAlert`, `requestGroceryPriceAlert`, `manageGrocerySubscription`, `getGroceryLoyalty`, `redeemGroceryLoyalty`, `registerGroceryCustomer`, `updateActiveUser`, `updateGroceryNotificationPreferences`, `groceryCustomerPrivacy`, `exportGroceryCustomerData`, `requestGroceryCustomerPrivacy`, `submitGroceryContactMessage`, `acceptGroceryStaffInvitation`. Some pages also use generated queries (`departments`, `orders`, `addresses`, `favoriteProducts`, `shoppingLists`, `subscriptions`). Verify each against the inspected revision.

The current product focus is departments and products, basket with substitution preferences, specials with coupon codes at checkout, delivery and pickup times, Stripe checkout with authorize-then-capture on picked goods, order tracking with substitution decisions and curbside check-in, guest order access, lists, favorites, recurring baskets and rewards, account and privacy, and help. There is no recipe page and no clip-a-coupon command. This list is orientation, not proof that every flow is safe or complete.

## Then interview the user

After the source orientation, ask one concise set of questions and skip anything already answered:

1. Where is the exact Grocery source checkout, and which revision/deployment is the target?
2. Do they want to adapt the built-in storefront or create an independently deployed client?
3. What do they dislike about the current experience, what must stay, and what should change?
4. Which customer journeys, routes, content, brand, devices, accessibility, and commerce/booking states are required?
5. What visual references, interaction direction, responsive targets, and deployment constraints matter?
6. Which non-production host, schema export, test data, and test identities are available?

Restate the brief, inspect the supplied source, identify presentation-only changes versus backend-contract work, and ask for confirmation before broad implementation.

## Required source inspection

Before proposing code:

1. Enumerate the actual app routes for this product.
2. Trace the built-in screen components and every data loader/server action they call.
3. Enumerate GraphQL documents and operation names used by those call sites.
4. Read `schema.graphql`, model access, field access, and custom query/mutation resolvers.
5. Record actor, tenant/store/organization scope, inputs, outputs, lifecycle authority, idempotency, and error states for each required operation.
6. Inspect provider adapters, webhooks, workers, uploads, cookies/tokens, and runtime configuration touched by the requested flow.
7. Produce a capability matrix: verified, presentation-only, needs backend contract, blocked, or absent.

Do not claim the skill already knows a deployed contract. It knows where and how to discover the exact calls. Generated CRUD or a schema-valid document is not proof of safe access.

## Built-in versus separate client

### Adapt the built-in client

- Keep route files thin.
- Put product UI and orchestration in the existing feature slice.
- Reuse current session, transport, design tokens, loading/error states, and named server operations where they are safe.
- Do not duplicate price, availability, lifecycle, payment, clinical/legal, or authorization decisions in components.

### Build a separate client

- Use a trusted, environment-pinned endpoint and checked named operations.
- Keep privileged credentials and opaque capabilities server-side behind a BFF when needed.
- Never expose an arbitrary GraphQL proxy or accept browser-selected fields, operations, relationships, provider IDs, or endpoint URLs.
- Pin the exact schema, generate strict types, runtime-validate JSON/custom scalars, and fail closed when a required contract is absent.
- Test anonymous, wrong-user, wrong-tenant/store/organization, stale, duplicate, timeout, and provider-failure behavior against disposable data.

## Product-specific boundary

Design around departments/products, basket, specials and coupon codes, lists, favorites, recurring baskets, substitutions, pickup/delivery, checkout, and order access. Preserve the product's real workflow nouns and authority boundaries. Never rename E-commerce products/orders into this vertical or borrow E-commerce GraphQL roots without validating that they exist and are authorized here.

For consequential actions, require one bounded server projection or command that validates actor, scope, related-record ownership, state transition, transaction/concurrency, idempotency, provider behavior, and audit evidence. If it does not exist, request the backend contract and show the feature as unavailable.

## Handoff

Report:

- built-in or separate mode;
- source path/repository and revision inspected;
- routes and built-in screens reviewed;
- schema hash and named operations used;
- requested changes and what was preserved;
- capability matrix and backend blockers;
- implemented files and tests;
- responsive/accessibility evidence;
- auth, scope, secret, provider, migration, deployment, and rollback notes.

Never present a source path, generated schema, HTTP 200, or attractive empty state as proof that the storefront workflow is operational.
