<aside> ✅ Build ScandiPWA as a Magento theme

</aside>

This guide requires 5 steps to be completed in sequence:

  1. Create a new Create Magento App
  2. Create a new Create Scandipwa App
  3. Link Magento App with ScandiPWA App
  4. Run ScandiPWA App in Magento mode
  5. Change Magento theme to ScandiPWA

1. Create a new Create Magento App

Install dependencies

Before setting up, make sure you have installed the libraries required to build the PHP. The list of these libraries can be found here: for Linux and macOS.

Also, make sure to install Docker and PHPBrew in your system.

Quick Start

# make sure dependencies are installed !!!
npx create-magento-app my-app
cd my-app
npm start

This command will start Docker services, start PHP and open your favorite browser with Magento 2 store.

Create Magento App, and choose an available port for Magento 2. By default, it will use port 80 so the URL for the store will be http://localhost:80/.

Creating a Magento App

<aside> 🚨 Make sure your Node version is up to date!

You’ll need to have Node >= 12 on your local development machine (but it’s not required on the server). You can use n (macOS, Linux) or nvm-windows to switch Node versions between different projects.

</aside>

To create a new app, you may choose one of the following methods:

<aside> ℹ️ You’re free to choose the name of the application by replacing my-app with the correct name.

</aside>

Output

Running any of these commands will create a directory called my-app inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies. Learn more in the folder structure guide.

<aside> ➡️ In case of issues - please refer to Create Magento App FAQ.

</aside>

2. Create a new Create ScandiPWA App

The ScandiPWA App creation is very similar to Storefront mode, however, the Magento 2 server configuration is not required as we will install our ScandiPWA as a composer dependency for our newly created Magento 2 server. Also, there is no need to update the proxy field on the package.json file.

Storefront Mode Setup

<aside> ✅ Create the ScandiPWA app inside the Magento directory, one convention is to use the name pwa.

</aside>

3. Link Magento App with ScandiPWA App

The Create Magento App (CMA) comes with a built-in mechanism for ScandiPWA theme linking. In order to link a ScandiPWA theme with the CMA project, execute one of the following commands from the CMA project root:

<aside> ➡️ This command will link your ScandiPWA theme from your selected path as a symbolic link and will disable the “Full Page” cache.

</aside>

4. Run ScandiPWA App in Magento mode

Run the command below from your ScandiPWA App directory:

This command will now watch the files and put their compiled versions into the magento/Magento_Theme folder.

5. Change the Magento theme to ScandiPWA

Go to your Magento Admin panel (by default it can be accessed on /admin), Content > Configuration, choose a website that you want to apply the theme on, click Edit and select your theme, click Save!

Open your store URL and the ScandiPWA theme should be online.

What’s next?

Learn what features and why we added on-top-of React + Redux stack:

How does ScandiPWA integrate with Magento?