LLM Docs Header: All requests to https://llm-docs.commercengine.io must include the Accept: text/markdown header (or append .md to the URL path). Without it, responses return HTML instead of parseable markdown.
Commerce Engine Skills Router
These skills cover B2C storefronts. B2B storefronts use the same SDK patterns plus customer-group-aware pricing and headers.
Current SDK Mental Model
All frameworks install @commercengine/storefront — a unified package with subpath exports per framework:
- SPA (
@commercengine/storefront): createStorefront(...) → storefront.public() / storefront.session()
- Next.js (
@commercengine/storefront/nextjs): createNextjsStorefront(...) → storefront.publicStorefront() / storefront.clientStorefront() / await storefront.serverStorefront()
- TanStack Start (
@commercengine/storefront/tanstack-start): createTanStackStartStorefront(...) → storefront.publicStorefront() / storefront.clientStorefront() + server entry for serverStorefront()
Core principle: public reads use the public accessor (API-key-backed, build-safe). Live session flows (auth, cart, orders) use the session/client/server accessor.
By Task
Setting up the SDK -> ce-setup
- Framework detection and SDK install
- Session storage selection
- Environment variables and one-config setup
Authentication & login -> ce-auth
- Anonymous session bootstrap
- OTP login, password login, password registration, password reset
- Account/profile flows
Products & catalog -> ce-catalog
- Products, categories, variants, search
- Reviews and recommendations
Cart & checkout -> ce-cart-checkout
- Hosted Checkout (recommended)
- Custom checkout (advanced)
- Cart CRUD, coupons, loyalty points, payments
Orders & returns -> ce-orders
- Order creation, order history, shipments, payments
- Cancellation and returns
Webhooks & events -> ce-webhooks
- Event handling, signature verification, async processing
Next.js / TanStack Start / Astro / SvelteKit patterns -> ce-ssr-patterns
publicStorefront() / clientStorefront() / serverStorefront()
- Bootstrap, Server Actions/functions, pre-rendering, token management
- Concrete references for Next.js, TanStack Start, Astro, and SvelteKit
SEO & structured data -> ce-seo
- Head metadata, JSON-LD (
Product/ProductGroup with variesBy), canonical URLs
robots.txt, sitemaps, llms.txt, and Markdown mirrors for AI crawlers
- Server-mount vs prebuild, per deployment mode
AI agent tools (WebMCP) -> ce-ai
- Catalog, cart, navigation and session tools via
document.modelContext
- Capability gating, cart semantics, and where the agent boundary sits
Custom SSR bindings -> ce-ssr
@commercengine/ssr-utils for frameworks without a first-party wrapper (Nuxt, etc.)
ServerTokenStorage and CookieAdapter
- Public build reads vs live request sessions
Storefront Pages
Canonical pages for a CE storefront and the skills/methods each needs:
| Page |
Example Route |
Skills |
Key SDK Methods |
| Home |
/ |
catalog |
listProducts, listCategories, recommendations |
| Product Listing |
/products, /categories/[slug] |
catalog |
searchProducts, listProducts |
| Product Detail |
/products/[slug] |
catalog |
getProductDetail, listProductVariants, listProductReviews |
| Cart |
Hosted Checkout drawer or /cart |
cart-checkout |
useCheckout().openCart() or sdk.cart.* |
| Checkout |
Hosted Checkout drawer or /checkout |
cart-checkout |
useCheckout().openCheckout() or custom checkout flow |
| Login |
/login |
auth |
loginWithEmail, loginWithPhone, verifyOtp, loginWithPassword |
| Account |
/account |
auth |
getUserDetails, updateUserDetails, changePassword |
| Orders |
/account/orders |
orders |
listOrders |
| Order Detail |
/account/orders/[id] |
orders |
getOrderDetails, listOrderShipments, listOrderPayments |
| SEO assets |
/robots.txt, /sitemap.xml, /llms.txt |
seo |
createCommerceSeo, mounted handler or prebuild |
| Markdown mirrors |
/product/[slug].md |
seo |
productMarkdown, content negotiation on the canonical URL |
Converting an Existing Project
- Install SDK - Follow
ce-setup. Install @commercengine/storefront.
- Replace public catalog reads first - Move listing/detail/category pages to
publicStorefront() / public().
- Add session-aware flows - Auth, cart, checkout, account, orders should use
clientStorefront() / serverStorefront() / session().
- Adopt Hosted Checkout or custom checkout - Follow
ce-cart-checkout.
- Add framework-specific SSR behavior if needed -
ce-ssr-patterns (Next.js / TanStack Start / Astro / SvelteKit) or ce-ssr (custom bindings for Nuxt, etc.).
Replace one data source at a time. Keep existing UI components where possible and swap the data layer first.
Decision Tree
User Request
│
├─ "Set up SDK" / "Add Commerce Engine" → ce-setup
├─ "Login" / "Auth" / "OTP" → ce-auth
├─ "Products" / "Categories" / "Search" → ce-catalog
├─ "Cart" / "Checkout" / "Payments" → ce-cart-checkout
├─ "Orders" / "Returns" / "Shipments" → ce-orders
├─ "Webhooks" / "Events" / "Sync" → ce-webhooks
├─ "Next.js" / "Server Actions" → ce-ssr-patterns (references/nextjs.md)
├─ "TanStack Start" / "Server functions" → ce-ssr-patterns (references/tanstack-start.md)
├─ "Astro" / "Astro SSR" → ce-ssr-patterns (references/astro.md)
├─ "SvelteKit" / "Svelte" / "Load functions" → ce-ssr-patterns (references/sveltekit.md)
├─ "SSR" / "Cookies" / "Custom binding" → ce-ssr
├─ "SEO" / "Sitemap" / "JSON-LD" / "llms.txt" → ce-seo
└─ "WebMCP" / "Agent tools" / "AI shopping" → ce-ai
Quick Navigation
/ce-setup
/ce-auth
/ce-catalog
/ce-cart-checkout
/ce-orders
/ce-webhooks
/ce-ssr-patterns
/ce-ssr
/ce-seo
/ce-ai
1---2name: ce3description: Commerce Engine router. Use when the user asks about building a storefront, setting up the SDK, auth, products, cart, checkout, orders, webhooks, SSR, SEO, AI agent tools, Next.js, or TanStack Start e-commerce patterns.4---56> **LLM Docs Header**: All requests to `https://llm-docs.commercengine.io` **must** include the `Accept: text/markdown` header (or append `.md` to the URL path). Without it, responses return HTML instead of parseable markdown.78# Commerce Engine Skills Router910These skills cover B2C storefronts. B2B storefronts use the same SDK patterns plus customer-group-aware pricing and headers.1112## Current SDK Mental Model1314All frameworks install `@commercengine/storefront` — a unified package with subpath exports per framework:1516- **SPA** (`@commercengine/storefront`): `createStorefront(...)` → `storefront.public()` / `storefront.session()`17- **Next.js** (`@commercengine/storefront/nextjs`): `createNextjsStorefront(...)` → `storefront.publicStorefront()` / `storefront.clientStorefront()` / `await storefront.serverStorefront()`18- **TanStack Start** (`@commercengine/storefront/tanstack-start`): `createTanStackStartStorefront(...)` → `storefront.publicStorefront()` / `storefront.clientStorefront()` + server entry for `serverStorefront()`1920Core principle: **public reads** use the public accessor (API-key-backed, build-safe). **Live session flows** (auth, cart, orders) use the session/client/server accessor.2122## By Task2324**Setting up the SDK** -> `ce-setup`25- Framework detection and SDK install26- Session storage selection27- Environment variables and one-config setup2829**Authentication & login** -> `ce-auth`30- Anonymous session bootstrap31- OTP login, password login, password registration, password reset32- Account/profile flows3334**Products & catalog** -> `ce-catalog`35- Products, categories, variants, search36- Reviews and recommendations3738**Cart & checkout** -> `ce-cart-checkout`39- Hosted Checkout (recommended)40- Custom checkout (advanced)41- Cart CRUD, coupons, loyalty points, payments4243**Orders & returns** -> `ce-orders`44- Order creation, order history, shipments, payments45- Cancellation and returns4647**Webhooks & events** -> `ce-webhooks`48- Event handling, signature verification, async processing4950**Next.js / TanStack Start / Astro / SvelteKit patterns** -> `ce-ssr-patterns`51- `publicStorefront()` / `clientStorefront()` / `serverStorefront()`52- Bootstrap, Server Actions/functions, pre-rendering, token management53- Concrete references for Next.js, TanStack Start, Astro, and SvelteKit5455**SEO & structured data** -> `ce-seo`56- Head metadata, JSON-LD (`Product`/`ProductGroup` with `variesBy`), canonical URLs57- `robots.txt`, sitemaps, `llms.txt`, and Markdown mirrors for AI crawlers58- Server-mount vs prebuild, per deployment mode5960**AI agent tools (WebMCP)** -> `ce-ai`61- Catalog, cart, navigation and session tools via `document.modelContext`62- Capability gating, cart semantics, and where the agent boundary sits6364**Custom SSR bindings** -> `ce-ssr`65- `@commercengine/ssr-utils` for frameworks without a first-party wrapper (Nuxt, etc.)66- `ServerTokenStorage` and `CookieAdapter`67- Public build reads vs live request sessions6869## Storefront Pages7071Canonical pages for a CE storefront and the skills/methods each needs:7273| Page | Example Route | Skills | Key SDK Methods |74|------|---------------|--------|-----------------|75| Home | `/` | catalog | `listProducts`, `listCategories`, recommendations |76| Product Listing | `/products`, `/categories/[slug]` | catalog | `searchProducts`, `listProducts` |77| Product Detail | `/products/[slug]` | catalog | `getProductDetail`, `listProductVariants`, `listProductReviews` |78| Cart | Hosted Checkout drawer or `/cart` | cart-checkout | `useCheckout().openCart()` or `sdk.cart.*` |79| Checkout | Hosted Checkout drawer or `/checkout` | cart-checkout | `useCheckout().openCheckout()` or custom checkout flow |80| Login | `/login` | auth | `loginWithEmail`, `loginWithPhone`, `verifyOtp`, `loginWithPassword` |81| Account | `/account` | auth | `getUserDetails`, `updateUserDetails`, `changePassword` |82| Orders | `/account/orders` | orders | `listOrders` |83| Order Detail | `/account/orders/[id]` | orders | `getOrderDetails`, `listOrderShipments`, `listOrderPayments` |84| SEO assets | `/robots.txt`, `/sitemap.xml`, `/llms.txt` | seo | `createCommerceSeo`, mounted handler or prebuild |85| Markdown mirrors | `/product/[slug].md` | seo | `productMarkdown`, content negotiation on the canonical URL |8687## Converting an Existing Project88891. **Install SDK** - Follow `ce-setup`. Install `@commercengine/storefront`.902. **Replace public catalog reads first** - Move listing/detail/category pages to `publicStorefront()` / `public()`.913. **Add session-aware flows** - Auth, cart, checkout, account, orders should use `clientStorefront()` / `serverStorefront()` / `session()`.924. **Adopt Hosted Checkout or custom checkout** - Follow `ce-cart-checkout`.935. **Add framework-specific SSR behavior if needed** - `ce-ssr-patterns` (Next.js / TanStack Start / Astro / SvelteKit) or `ce-ssr` (custom bindings for Nuxt, etc.).9495> Replace one data source at a time. Keep existing UI components where possible and swap the data layer first.9697## Decision Tree9899```100User Request101 │102 ├─ "Set up SDK" / "Add Commerce Engine" → ce-setup103 ├─ "Login" / "Auth" / "OTP" → ce-auth104 ├─ "Products" / "Categories" / "Search" → ce-catalog105 ├─ "Cart" / "Checkout" / "Payments" → ce-cart-checkout106 ├─ "Orders" / "Returns" / "Shipments" → ce-orders107 ├─ "Webhooks" / "Events" / "Sync" → ce-webhooks108 ├─ "Next.js" / "Server Actions" → ce-ssr-patterns (references/nextjs.md)109 ├─ "TanStack Start" / "Server functions" → ce-ssr-patterns (references/tanstack-start.md)110 ├─ "Astro" / "Astro SSR" → ce-ssr-patterns (references/astro.md)111 ├─ "SvelteKit" / "Svelte" / "Load functions" → ce-ssr-patterns (references/sveltekit.md)112 ├─ "SSR" / "Cookies" / "Custom binding" → ce-ssr113 ├─ "SEO" / "Sitemap" / "JSON-LD" / "llms.txt" → ce-seo114 └─ "WebMCP" / "Agent tools" / "AI shopping" → ce-ai115```116117## Quick Navigation118119- `/ce-setup`120- `/ce-auth`121- `/ce-catalog`122- `/ce-cart-checkout`123- `/ce-orders`124- `/ce-webhooks`125- `/ce-ssr-patterns`126- `/ce-ssr`127- `/ce-seo`128- `/ce-ai`