AEM Venia PWA

This project contains the AEM package required to manage the content served to the PWA studio App. The PWA studio app is also part of this project.

Modules

The AEM package

The AEM package was bootstrapped using the AEM Project Archetype, to it has the specific structure of that project.

  • ui.apps contains the configuration, the resource types and the client libraries
  • ui.content contains the sample content
  • core contains the Sling Models require to render the content

Prerequisites for local development

Since this project involves a lot of resources loaded client site you need to set up a CORS proxy in your local environment. I use local-cors-proxy because spinning up a proxy is a one liner, but any proxy server solution would do.

npx local-cors-proxy --proxyUrl (your PWA Studio app URL) --port 8888 --proxyPartial ''

The PWA Studio app

The PWA studio app is in the ui.frontend project. For instructions on how to build and run the app, please refer to the README of that project.

Build, install, run

Prerequisites: clone this repository

Step 1: Build and configure the PWA studio app

Refer to the (PWA Studio app README)[./ui.frontend/README] for details about installing and running the PWA Studio app.

Step 2: Configure the AEM package

In order to allow an external app to access the AEM instance from a different URL you need to configure CORS. The configuration is found in src/main/content/jcr_root/apps/venia/config/com.adobe.granite.cors.impl.CORSPolicyImpl-spa.config. Make sure you replace the alloworigin setting with the URL generated by the PWA Studio app (see the PWA Studio app README).

Step 3: Install the AEM package

Use mvn clean install -PautoInstallSinglePackage to install this package in AEM.

Step 4: Check that everything works

Open the URL of the PWA Studio App in your browser. The home page of the app should display a product teaser from your Magento instance. Depending on what sample data you have in your local instance you may need to re-configure the SKU that the product teasers is using.