The @laioutr-app/shopify package integrates a Laioutr-powered Nuxt app with a Shopify store. It uses three APIs: the Storefront API (products, collections, cart, menu, content), the Admin API (media library, files), and the Customer Account API (OAuth2 login, customer profile, addresses). The package registers with the Laioutr orchestr (queries, actions, links, resolvers, templates), provides a Nuxt Image provider for Shopify CDN media, a media library provider for the Laioutr Studio (list and upload), and sections/blocks for content pages.
To use it, you add the module to your Nuxt config and set the seven required connection options (store domain and IDs, Storefront and Admin tokens, Customer Account OAuth client and redirect URI). The package then exposes canonical ecommerce capabilities so your UI can stay backend-agnostic while talking to Shopify.
The module expects configuration under the key @laioutr-app/shopify in nuxt.config.ts (or via runtimeConfig). All seven options are required for full functionality (Storefront, Admin, and Customer Account features).
| Option | Type | Description |
|---|---|---|
shopId | string | Shopify shop identifier. Use the format id.myshopify.com (e.g. my-store.myshopify.com). Required for the Customer Account API URL. |
storeDomain | string | Store domain in the same format: id.myshopify.com. Used by the Storefront and Admin API clients to resolve the API base URL. |
privateAccessKey | string | Storefront API private access token. Create a custom app in the Shopify Admin (Settings → Apps and sales channels → Develop apps) and generate a token with Storefront API access. |
adminAccessToken | string | Admin API access token. From the same or another custom app, with Admin API scopes (e.g. read_products, read_files, write_files, read_metaobject_definitions, read_metaobjects for media library and metaobjects). |
customerAccountApiClientId | string | OAuth2 Client ID for the Customer Account API. Created when you enable Customer Account API access for your app (Shopify Admin → App setup). |
customerAccountApiClientSecret | string | OAuth2 Client Secret for the same Customer Account API app. Keep this secret and only use it on the server (the module stores it in private runtime config). |
redirectUri | string | OAuth2 redirect URI for the Customer Account login flow. Must exactly match the redirect URL configured in your Shopify app (e.g. https://your-frontend.com/api/orchestr/action/oauth/callback or your Laioutr OAuth callback route). |
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@laioutr-app/shopify', '@laioutr-core/orchestr', '@nuxt/image'],
'@laioutr-app/shopify': {
shopId: process.env.SHOPIFY_SHOP_ID!,
storeDomain: process.env.SHOPIFY_STORE_DOMAIN!,
privateAccessKey: process.env.SHOPIFY_STOREFRONT_PRIVATE_ACCESS_TOKEN!,
adminAccessToken: process.env.SHOPIFY_ADMIN_ACCESS_TOKEN!,
customerAccountApiClientId: process.env.SHOPIFY_CUSTOMER_ACCOUNT_API_CLIENT_ID!,
customerAccountApiClientSecret: process.env.SHOPIFY_CUSTOMER_ACCOUNT_API_CLIENT_SECRET!,
redirectUri: process.env.SHOPIFY_REDIRECT_URI!,
},
});
Use environment variables (or a similar secret source) for all tokens and secrets in production; do not commit them.
storeDomain and privateAccessKey. It sends the buyer’s IP in the Shopify-Storefront-Buyer-IP header when available (for geo/rate limiting). Cart is identified by the cart ID stored in the cookie shopify-cart-id; the client creates or updates the cart via the Storefront API and persists the ID in that cookie.storeDomain and adminAccessToken. It is used for the media library provider (list files, staged uploads, create file) and any future admin-only features. Ensure the token has the scopes required by those features.customerAccountApiClientId, customerAccountApiClientSecret, redirectUri, and shopId to build the API URL and perform OAuth2. Login redirects the user to Shopify’s authorization URL; after approval, Shopify redirects to redirectUri with a code; the package exchanges the code for access/refresh/id tokens and stores them in cookies (shopify-access-token, shopify-refresh-token, shopify-id-token). Authenticated customer requests (e.g. get current customer, addresses) use the access token and refresh it when expired.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.
authorizationUrl for redirect.shopifyhttps://cdn.shopify.com.@nuxt/image; ensure the Nuxt Image module is installed.shopifyread_files and write_files (and any other scopes required by your app).ShopifyContentPageBlock) and a pagetypes plugin for content-page page types. Use these in the Laioutr Studio to build pages backed by Shopify content.https://your-domain.com/api/orchestr/action/oauth/callback or the route that handles AuthOAuthCallbackAction).https://shopify.com/{shopId}/account/customer/api/...). For OAuth, the redirect URI must be reachable by the user’s browser and by Shopify after login.shopify-cart-id. It creates a cart on first add-to-cart and updates the cookie when the API returns a new cart ID.shopify-access-token – Access token (short-lived).shopify-refresh-token – Refresh token (long-lived).shopify-id-token – ID token (for identity).shopify-oauth-state and shopify-oauth-nonce and cleared after the callback. Cookie options are httpOnly, secure, sameSite strict, path /. Ensure your domain and HTTPS setup match so cookies are sent and accepted.openid email customer-account-api:full (see package const).id.myshopify.com) and shop ID (same format for Customer Account API URL).@laioutr-app/shopify to modules and set all seven options under '@laioutr-app/shopify'./api/orchestr/action/oauth/callback) is the one configured as redirectUri in Shopify and in your config.shopify Nuxt Image provider for Shopify CDN URLs.shopify media library provider will list and upload files once the Admin API and token are correctly configured.