The @laioutr-app/adobe-commerce package integrates a Laioutr-powered Nuxt app with Adobe Commerce (Magento). It uses the Adobe Commerce GraphQL API for categories, products, cart, and catalog search. The package registers with the Laioutr orchestr (queries, actions, links, component resolvers, query template providers), provides a Nuxt Image provider for Adobe Commerce media (with responsive thumbnails), and exposes canonical ecommerce capabilities so your UI can stay backend-agnostic.
Authentication is via a Bearer access token (admin/integration token or customer token). The module expects baseURL, credentials (accessToken; consumerKey, consumerSecret, accessTokenSecret are in the config for future use), and imagesConfig for image dimensions and optional probing. Cart is identified by the cart ID stored in the cookie cart-id; the package creates a new cart when needed and persists the ID in that cookie.
The module expects configuration under the key @laioutr-app/adobe-commerce in nuxt.config.ts (or via runtimeConfig / laioutrrc.json). Required options: baseURL, consumerKey, consumerSecret, accessToken, accessTokenSecret. imagesConfig has defaults.
| Option | Type | Description |
|---|---|---|
baseURL | string | Adobe Commerce instance base URL (no trailing slash), e.g. https://your-domain.com. Used to build the GraphQL endpoint (default ${baseURL}/graphql). |
consumerKey | string | OAuth consumer key (reserved for future OAuth/integration flows). Keep secret; store in private config only. |
consumerSecret | string | OAuth consumer secret. Keep secret; store in private config only. |
accessToken | string | Bearer access token (admin/integration token or customer token). Sent as Authorization: Bearer <token> on every GraphQL request. Required for the SDK. |
accessTokenSecret | string | OAuth access token secret (reserved for future use). Keep secret. |
imagesConfig | object | Image handling. optInForProbing (optional): detect image dimensions via probing; default false. smallImageSize: { width, height } for small image (default 1000×1000). thumbnailSize: { width, height } for thumbnail (default 600×600). Used by media mappers and the Nuxt Image provider. |
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@laioutr-app/adobe-commerce', '@laioutr-core/orchestr', '@nuxt/image'],
'@laioutr-app/adobe-commerce': {
baseURL: process.env.ADOBE_COMMERCE_BASE_URL!,
consumerKey: process.env.ADOBE_COMMERCE_CONSUMER_KEY!,
consumerSecret: process.env.ADOBE_COMMERCE_CONSUMER_SECRET!,
accessToken: process.env.ADOBE_COMMERCE_ACCESS_TOKEN!,
accessTokenSecret: process.env.ADOBE_COMMERCE_ACCESS_TOKEN_SECRET!,
imagesConfig: {
optInForProbing: false,
smallImageSize: { width: 1000, height: 1000 },
thumbnailSize: { width: 600, height: 600 },
},
},
});
Use environment variables (or a similar secret source) for all credentials in production; do not commit them.
graphql-request) per request with baseURL and credentials: { accessToken }. The endpoint is ${baseURL}/graphql unless overridden. Optional Store header can be set for multi-store. The SDK is used for both catalog (admin) and cart; adobeCommerceClient and adobeCommerceAdminClient are created with the same access token and passed into the orchestr context.cart-id (httpOnly, secure, sameSite: strict, path: /, maxAge 30 days). GetCurrentCartQuery returns the cookie value (may be empty). CartAddItemsAction calls assertCartIdExists: if no cookie, it creates an empty cart via GraphQL, sets the cookie, then adds items.runtime/app/public as Nitro public assets (e.g. app logo at /app-adobe-commerce/adobe-commerce-logo.svg) with a 7-day cache.adobecommerce so Nuxt Image can resolve and optimize images. The provider supports width/height modifiers and picks the best-matching thumbnail from the responsive sources encoded in the image URL.The package implements Laioutr’s canonical ecommerce types via the orchestr. The following lists what is available; for exact types and payloads, refer to @laioutr-core/canonical-types and the package source.
{ id: category.uid }.alias === "root" fetches all top-level categories via getAllCategories; otherwise fetches category by slug and uses its children. Flattens tree, stores in categoriesPassthroughToken. Returns ids (category uids). Cached (TTL 1 hour, keyed by alias).{ id: product.sku }. Cached (TTL 24h, keyed by slug).ids (product SKUs), total, sorting, availableFilters, availableSortings. Uses mappers to convert Adobe Commerce aggregations/sort fields to canonical shapes. Cached (SWR 1 day; cache key only for “landing” requests). Stores products in passthrough.alias = category url_key or uid; label = category name or meta_title.categorySlug = category url_key or uid; label = category name or meta_title. Search filter (term ≥ 3) uses searchCategories.type === "product" are sent as { sku: variantId, quantity } to addItemsToCart. Uses adobeCommerceClient (same token as admin in current implementation).includeProductVariant. For configurable products, returns child variant SKUs; for simple products, returns the product SKU as the only target. Stores products in variantsPassthroughToken. Cached (SWR 1 day for landing requests).Product and category media are mapped to canonical MediaImage / MediaVideo with provider: "adobecommerce". The package provides:
# + thumbnail list); supports width and height modifiers and returns the best-matching thumbnail URL and dimensions.Ensure @nuxt/image is in your Nuxt config when using the provider.
/graphql). Store configured with categories and products (url_key, SKU, price, inventory, etc.).types/__generated__/graphql.ts and codegen). Ensure your schema matches or extend the queries/mutations used.| Cookie | Purpose |
|---|---|
| cart-id | Adobe Commerce cart ID. Set when a new cart is created (e.g. on first add-to-cart). Used by GetCurrentCartQuery and CartAddItemsAction. |
CATEGORY_NOT_FOUND.PRODUCT_NOT_FOUND.@laioutr-app/adobe-commerce (e.g. from env).Coding Standards
Conventions and quality guidelines for developing Laioutr apps. Use these standards to keep app code consistent, maintainable, and aligned with the Laioutr ecosystem.
Battery Included
Developer documentation for the Laioutr Battery Included app package. Add search, suggested search, and product recommendations to your Laioutr frontend via the BatteryIncluded API.