AEM Commerce Prerender
The AEM Commerce Prerender solution enables your Edge Delivery Services Commerce Storefront to serve fully-rendered product pages to search engines and AI crawlers before JavaScript executes. This improves SEO rankings and makes your product catalog accessible to LLMs.
How it works: You deploy an App Builder application that runs continuously in Adobe’s cloud, monitoring your catalog and generating complete HTML for each product. This HTML publishes to Edge Delivery Services, where your storefront serves it to visitors. Your storefront’s product-details block then enhances the prerendered HTML with interactive features powered by the PDP drop-in. You must deploy the App Builder app first because your storefront integration depends on the HTML it generates.
Why use prerender?
Modern storefronts use client-side JavaScript to render product information, limiting discoverability by search engines and AI systems that don’t execute JavaScript. Prerendering solves this by generating complete HTML with structured data before pages are requested.
Key Benefits:
- Enhanced SEO: Complete HTML for search engines improves indexing and rankings
- LLM Readability: Structured markup that AI systems can parse and understand
- Improved Performance: Reduces the time-to-first-byte and serves immediate content
- Natural Fallback: Pre-rendered content displays while client-side drop-ins load
- Automated Updates: Monitors the product catalog and updates markup when products change
Implementation roadmap
This guide walks you through implementing the prerender solution in both required repositories. Follow these steps in order:
Prerequisites
Before implementing the prerender solution, verify you have:
Required Access and Permissions
- Adobe Developer Console access with “Developer” role for your organization
- App Builder workspace (Stage and Production workspaces recommended)
- AEM Admin API access for your Edge Delivery Services project
- Adobe Commerce instance with Catalog Service configured and operational
Storefront Requirements
Your Edge Delivery Services Commerce Storefront must be:
- Built on the Commerce boilerplate
- Configured with valid storefront configuration connecting to your Adobe Commerce backend
- Using product URLs with consistent format (typically
/products/{urlKey}/{sku})
Technical Requirements
- Node.js (current LTS version) installed locally
- Adobe I/O CLI (
@adobe/aio-cli) installed globally - Git for cloning the prerender repository
- Familiarity with JavaScript, Handlebars templates, and GraphQL
How it works
The prerender system operates as a continuous background process:
- The store admin manages products in Adobe Commerce
- The Prerender Stack detects product changes
- The Prerender Stack renders pages with semantic markup
- The pages are published via the AEM Admin API
- The sitemap is updated via the AEM Admin API
- Store customers access the pre-rendered product details pages
Architecture Components
The solution consists of these components:
- App Builder Actions: Serverless functions that handle product fetching, change detection, and markup generation
- Scheduled Triggers: Automated intervals (configurable) that invoke actions to keep content synchronized
- Catalog Service Integration: Queries product data from your Adobe Commerce backend
- AEM Admin API: Publishes generated markup to your Edge Delivery Services project
- Storage Layer: Maintains product state and generated markup in App Builder storage
- Management UI: Web interface for monitoring, configuration, and troubleshooting
Installation and configuration
The AEM Commerce Prerender repository provides complete installation instructions. The following overview highlights the key configuration steps and values you’ll need.
-
Clone the repository and install dependencies:
git clone https://github.com/adobe-rnd/aem-commerce-prerender.gitcd aem-commerce-prerendernpm install -
Run the setup wizard to generate your
.envconfiguration:npm run setupThe wizard prompts for your App Builder workspace selection and Adobe I/O authentication.
-
Configure environment variables in the generated
.envfile with your storefront-specific values:Variable Description Example CATALOG_SERVICE_URLYour Adobe Commerce Catalog Service endpoint https://catalog-service.adobe.io/graphqlAEM_ADMIN_API_KEYAdmin API token from your AEM project settings your-admin-token-hereAEM_ORGYour AEM organization identifier (e.g., adobe)adobeAEM_SITEYour AEM site name (e.g., your-storefront)your-storefrontPRODUCT_PAGE_URL_FORMATURL pattern for product pages /products/{urlKey}/{sku}COMMERCE_ENVIRONMENT_IDCommerce instance environment ID from Commerce Admin xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxCOMMERCE_WEBSITE_CODEWebsite code from Commerce multistore setup baseor your store codeCOMMERCE_STORE_VIEW_CODEStore view code from Commerce defaultor your view code -
Obtain required credentials:
- AEM Admin API token: Generate from your AEM project admin panel
- Commerce credentials: Access your Commerce Admin → System → Services → Commerce Services Connector for environment and API configuration
- App Builder credentials: Automatically configured when you authenticate via the setup wizard
-
Deploy to App Builder:
npm run deployThis deploys all actions and schedules to your selected workspace (Stage or Production).
-
Test the deployment:
- Manually invoke actions using the Management UI or
aio rt action invoke - Verify product markup generation for sample SKUs
- Check that pages publish successfully to your AEM project
- Manually invoke actions using the Management UI or
-
Enable automated synchronization:
- Use the Management UI to start the change detector
- Configure polling intervals (default: checks for changes every 5 minutes)
- Monitor the product index to verify continuous updates
Management UI
After deployment, access the web-based Management UI to monitor and control your prerender deployment. The UI requires configuration with your App Builder workspace credentials before it displays deployment-specific data.
The Management UI provides:
- Monitoring capabilities to view published products and track the product index
- Change detector controls to start, stop, and configure scheduled product polling
- Markup preview to view generated HTML for product pages before publication
- Logs and activations for debugging App Builder action executions
- Storage management to trigger manual product operations and manage blob storage
- Configuration settings to review environment variables and deployment parameters
Access and authentication details are configured during the initial deployment process. Refer to the repository documentation for setup instructions.
Storefront integration
After installing the prerender solution, modify your Commerce boilerplate to integrate prerendered markup with your product detail pages.
Understanding the Two-Repository Architecture
The prerender solution involves two separate codebases that work together:
-
The aem-commerce-prerender repository (App Builder app)
- This is what you cloned, configured, and deployed in the previous section
- Runs as a serverless application in Adobe App Builder
- Generates prerendered HTML and publishes it to your Edge Delivery Services site
- Operates independently as a background process
-
Your storefront repository (Commerce boilerplate)
- Your customer-facing website code
- Built on the Commerce boilerplate
- Needs code modifications to properly consume the prerendered HTML
- This is where you’ll make the integration changes described below
How they connect: The App Builder app publishes prerendered HTML to Edge Delivery Services at URLs matching your product pages (e.g., /products/acme-widget/SKU123). When a visitor (or crawler) requests a product page, Edge Delivery Services serves this prerendered HTML. Your storefront’s JavaScript then enhances the page by replacing the static HTML with the interactive PDP drop-in.
How Prerendered HTML Reaches Your Storefront
The prerendered HTML flows from the App Builder app to your storefront through the AEM Admin API:
Publishing mechanism:
- The App Builder app generates HTML → Creates complete HTML files with prerendered product markup
- API call to AEM Admin → The App Builder app makes authenticated API calls using your
AEM_ADMIN_API_KEY - Content published to EDS → The Admin API publishes the HTML files to Edge Delivery Services at the specified product URLs
- Sitemap updated → The Admin API also updates your sitemap to include the new/updated product pages
- Content available → Edge Delivery Services now has the HTML files stored and ready to serve
This is not an event-based system: it’s a direct API integration. Each time the App Builder app detects a product change and generates HTML, it immediately publishes that HTML to Edge Delivery Services via API calls. Your storefront doesn’t need to do anything special to “receive” these files; they’re automatically available at the product URLs once published.
How the Storefront Serves Prerendered HTML
When a visitor requests a product page URL (e.g., /products/acme-widget/sku123), Edge Delivery Services serves the prerendered HTML as the actual page. The HTML already contains the product-details block populated with prerendered content; your storefront doesn’t fetch it separately.
The delivery sequence:
- Request arrives → Edge Delivery Services receives the URL request
- HTML served → EDS returns the prerendered HTML file (published by the App Builder app)
- Page loads → The browser displays the page with prerendered content (crawlers stop here)
- JavaScript executes → Your storefront code runs
- Enhancement → The
product-detailsblock’sdecorate()function replaces static HTML with interactive UI
This is progressive enhancement: the prerendered HTML is the initial page that everyone sees. Your storefront code simply finds what’s already in the DOM, extracts the SKU from the meta tag, and upgrades it to an interactive experience for users with JavaScript. This approach ensures crawlers always see complete product information, users with JavaScript enabled get the full interactive experience, and users without JavaScript still see product details (though without dynamic features).
Modifying Your Product Details Block
Developers must modify the product-details block in their Commerce boilerplate to integrate prerendered markup with the PDP drop-in.
Location
The product-details block lives in your boilerplate at:
blocks/product-details/product-details.jsIntegration Pattern
Your block’s decorate() function should:
- Preserve prerendered markup: The block already contains server-rendered HTML visible to crawlers before JavaScript executes.
- Retrieve the SKU: Get the product SKU from the
<meta name="sku">tag instead of parsing the sanitized URL. - Replace with PDP drop-in: Clear the prerendered content and render the interactive PDP component.
export default async function decorate(block) { // Step 1: Preserve prerendered markup // The block already contains HTML. No action needed here; // crawlers see this content before JavaScript runs
// Step 2: Retrieve the SKU from meta tag const skuMeta = document.querySelector('meta[name="sku"]'); const sku = skuMeta?.content || getSkuFromUrl();
// Step 3: Replace with PDP drop-in block.innerHTML = ''; // Clear prerendered content await productRenderer.render(ProductDetails, { sku })(block); // Render interactive UI}URL Format and SKU Handling
The prerender system generates markup files that match your storefront’s product URL structure. By default, this uses the format:
/products/{urlKey}/{sku}The PRODUCT_PAGE_URL_FORMAT can be customized in your .env configuration .
For complete implementation examples, refer to the product-details block in the Commerce boilerplate.
Customization
The prerender solution provides these customization options:
| Customization | Purpose and Configuration |
|---|---|
| Templates | Control HTML markup structure and styling by modifying tools/templates/pdp.handlebars |
| Structured Data | Customize JSON-LD schemas in tools/structured-data/product.js to optimize product rich snippets for search engines |
| GraphQL Queries | Extend product data by adjusting Catalog Service queries in actions/pdp-renderer/index.js to fetch additional attributes |
| URL Patterns | Match your storefront URL structure by configuring PRODUCT_PAGE_URL_FORMAT in the .env file |
| Rendering Logic | Transform product data before markup generation by implementing custom logic in App Builder actions |
For implementation details, see the AEM Commerce Prerender repository , particularly the actions/, tools/, and repository root for templates and configuration files.
Troubleshooting
For troubleshooting during development and operations, consult the prerender runbook .
Common issues include:
-
Authentication failures: Verify your AEM Admin API token is valid (tokens expire after 1 year)
- Check token expiration in your AEM project admin panel
- Generate a new token if expired and update
AEM_ADMIN_API_KEYin your.envfile - Redeploy with
npm run deployafter updating credentials
-
Product not rendering: Check that the product exists in Catalog Service and the SKU matches
- Query Catalog Service directly using its GraphQL Product API to verify product data
- Use the Management UI to view the product index and confirm the SKU is listed
- Check the
pdp-rendereraction logs in App Builder for GraphQL errors:aio rt activation list pdp-renderer
-
Markup not updating: Review the Change Detector logs to ensure scheduled triggers are running
- Access the Management UI to verify the change detector status (should show “Running”)
- Check activation logs:
aio rt activation list product-change-detector - View detailed logs:
aio rt activation logs <ACTIVATION_ID> - Manually trigger the change detector from the Management UI to test functionality
-
Storage errors: Verify your App Builder workspace has sufficient storage quota
- Check storage usage in the Adobe Developer Console under your App Builder workspace
- Review blob storage logs:
aio rt activation list blob-store - Contact Adobe support to request quota increases if needed
Additional resources
- App Builder Documentation: Adobe Developer App Builder
- Catalog Service Guide: Adobe Commerce Catalog Service
- Edge Delivery Services: Publishing to Edge Delivery Services
Support
For technical issues or questions during implementation, consult the runbook or contact Adobe Commerce support.
To explain prerendering benefits to store administrators, refer to the merchant documentation.