English source · 4 min
kit/storefront
The storefront kit. Each part has one typed contract (definePart): a Zod schema
of serializable props and a configuration schema (what a merchant sets in the
Visual Builder, such as which product), from which come the TypeScript types, validation of untrusted
props (attributes, stored blocks, model output), the JSON Schema used by builder
forms, MCP tools and the server, and the React component. Parts are styled through
design tokens only and carry their own four-language vocabulary; hosts pass the
locale and data, and receive buyer intents as callbacks (onAddToCart,
onCheckout).
Modules
index.ts: The public interface.parts.ts: Thepartslist in builder order andpartById.contract.ts:definePartand shared field shapes (locale, currency, amount, safe URL).storefront-i18n.ts: Part vocabulary in English, German, French and Spanish; money formatting.ProductCard.tsx: Product card.ProductSummary.tsx: Purchase area of a product page.CartSummary.tsx: Priced cart lines with quantity controls, discounts, taxes, totals and delivery window from the server cart.CheckoutSteps.tsx: Checkout progress; never implies a confirmed payment.AccountOverview.tsx: The account home (greeting, counts, recent orders) and the order list part.elements.tsx:registerPartElementsdefines<veyndo-<id>>web elements that validate theirpropsattribute, upgrade server-rendered fallback markup (islands) and emitveyndo:add-to-cart,veyndo:checkout,veyndo:quantityandveyndo:openevents.PartForm.tsx: The Visual Builder form of a part's configuration, generated from its configuration JSON Schema; hosts supply localized labels and pickers for special formats such asproduct-id.standalone-styles.ts: Injects the token, ui and part styles for entries that load without the app stylesheet.mcp-app.tsx: The MCP App view: speaks the MCP Apps bridge (2026-01-26), renders the part payload of a tool result and sends buying to the shop throughui/open-link;renderMetalets kit/catalog add documents. Its bundle entry and the/assets/elements.jsembed entry live in kit/catalog.storefront.css: Part styles; the architecture check refuses colour literals here.
Prices, stock and totals always come from the server; parts only show them.
Where the parts run
- Storefront app. Every purchase surface renders kit parts through thin
adapters: product tiles (
shell/ProductTile), the product page purchase area (catalog/ProductPurchase, the buy box with variants, quantity prices and app slots), the checkout order review and order completion (cart summary), checkout steps, the account home and order lists, and the account order detail. Adapters translate shop data and keep navigation, app slots and cart rules; the storefront theme styles the kit classes. The chat purchase review (ConversationPurchase) stays its own explicit confirm flow, and B2B quote lines belong to the B2B owner. - Site builder. Pages place the product card and the buy box as
kind: "part"blocks (seeextensions/apps/site-builder/README.md); the inspector isPartForm, and Rust validates the stored configuration against the schema generated from these contracts. - Islands. For deep-linked product pages Rust (
src/storefront_islands.rs) renders<veyndo-product-summary>into the document root: props from the Store API product owner and escaped, language-neutral fallback markup, so crawlers, agents and visitors without JavaScript see the product. The storefront app then mounts over it; a host that loadselements.jshydrates it instead. -
Embedding. Another site loads
<script type="module" src="https://<shop>/assets/elements.js">and writes<veyndo-product-card props='{"product":{…}}' locale="de-DE">. The element validates the attribute with the part schema (invalid props keep the fallback and setdata-invalid) and emitsveyndo:add-to-cart,veyndo:checkout,veyndo:quantityandveyndo:openevents; the host decides what they do. Cross-origin hosts need the shop to serve the script with CORS. -
Agents (MCP Apps). The hosted
/mcpserver linkscatalog.detail,catalog.search,cart.create,cart.quoteandcart.replaceto the viewui://veyndo/kit/storefront(_meta.ui.resourceUri, plus theopenai/outputTemplatealias ChatGPT still honours) and serves it as a self-containedtext/html;profile=mcp-appdocument built from these contracts (src/mcp/storefront_views.rs). Each result carries its part props in_meta["ai.veyndo/part"], derived from the same Store API answer the model sees (buy box, product cards, cart summary); hosts do not pass_metato the model. The view never takes payment: add to cart opens the shop's own product page, the agent's cart is shown read-only with its lines linking to their product pages (changing it and purchase stay with the agent's native tools), and only HTTPS links leave the sandbox. Images and links needCOMMERCE_PUBLIC_ORIGIN; without it the view shows the parts without them.
Verification
Run npm test -- kit-storefront and npm run architecture from frontend/.