executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
headless-ecommerceShopify Storefront API and Hydrogen best practices.
Independent GitHub snapshot · Automated classification · Original documentation governs
Focus on fetching data efficiently, caching, and edge computing for ultra-fast storefronts.
@shopify/hydrogen's CacheLong, CacheShort, and custom cache directives for all Storefront API queries.import { CacheLong, gql } from '@shopify/hydrogen';
import type { LoaderArgs } from '@shopify/remix-oxygen';
const PRODUCTS_QUERY = gql`
query FeaturedProducts {
products(first: 3) {
nodes {
id
title
handle
variants(first: 1) {
nodes {
price {
amount
currencyCode
}
}
}
}
}
}
`;
export async function loader({ context }: LoaderArgs) {
const { products } = await context.storefront.query(PRODUCTS_QUERY, {
cache: CacheLong(),
});
return { products };
}
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
A[Client Browser] -->|Requests Page| B(Hydrogen Edge Worker)
B -->|Check Cache| C{Cache Hit?}
C -- Yes --> D[Return Cached HTML/JSON]
C -- No --> E[Storefront API]
E -->|Fetch Data| B
B -->|Render & Cache| D
D --> A